Re: [PHP4BETA] Anyone had a chance to look HTTP_POST_FILES?
| From: | Shane Burrell | Date: | Sun, 12 Mar 2000 22:12:05 +0000 |
| Subject: | Re: [PHP4BETA] Anyone had a chance to look HTTP_POST_FILES? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11993@lists.php.net to get a copy of this message | ||
On Sat, 11 Mar 2000, you wrote:
> I submitted the following patch to make HTTP_POST_FILES work when
> register_globals = off. The problem was we couldn't find a way to access the
> tmp name in HTTP_POST_FILES. I'm was unable to test to see if it breaks things
> with register_globals=on but it seems to work great with it off. It allows us
> to access the temp filename via $HTTP_POST_FILES['tmpname']. I am preparing to
> convert some code and just wanted to see if I could depend on the tmpname or
> find out if there was another way to get the value of the tmpname. The patch
> may not be needed if there is a built in method for getting the orignal
> $userfile value. I was unable to find such a method.
>
> Index: rfc1867.c
> ===================================================================
> RCS file: /repository/php4/rfc1867.c,v
> retrieving revision 1.30
> diff -r1.30 rfc1867.c
> 129c129,131
> < lbuf = emalloc(s-name +
> MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]")));
> ---
> >
> > lbuf = emalloc(s-name +
> > MAX(MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]")),sizeof("[tmpname]")));
> >
> 269a272,276
> >
> > /* Add $foo[tmpname] */
> > sprintf(lbuf, "%s[tmpname]", namebuf);
> > register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC);
> >
Over the weekend I applied this patch to running code and had no problems. I
also tested with old $userfile code with register_globals=on with no problems.
I am going to continue to code around using this patch until someone tells me
otherwise. Hopefully I did things correctly and this will get applied to the
cvs tree.