[Gllug] PHP Again

Alex Hudson home at alexhudson.com
Tue Jul 24 20:24:56 UTC 2001


On Tue, Jul 24, 2001 at 06:16:47PM +0100, Tom Gilbert wrote:
> > > if ($HTTP_POST_FILES['userfile']['tmp_name']=="none"){
> > 
> > Isn't $HTTP_POST_FILES['userfile']['tmp_name'] an array rather than a value?
> > 
> > EG, does $HTTP_POST_FILES['userfile']['tmp_name'][0] work??
> > 
> > (Convievably you might want to upload more than one file at a time.)
> 
> No, $HTTP_POST_FILES is an array (well, hash, but this is php), which is
> why you ask for $HTTP_POST_FILES['userfile'] (the one called userfile).

I know $HTTP_POST_FILES is an array! But it happens to be an array of arrays
- i.e., $HTTP_POST_FILES['userfile'] is also an array, because it should
contain $HTTP_POST_FILES['userfile']['tmp_name'] (for example). 

Having looked up in my php manual, it seems the 3-dimensional array I was
thinking of was array form (eg. <input type="file" name="userfile[]"..>),
which does lead to HTTP_POST_FILES['item'][*] being arrays rather than
values. 

Anyway, back to the point - Harry's code doesn't work over here, although
it's not because of a parse error - I think HTTP_POST_FILES is only php
version 4 or above? $userfile, $userfile_name, $userfile_size etc., all work
for me though. Harry's scripts don't work for me, but that's because I don't
have a HTTP_POST_FILES - it doesn't generate a parse error.

If $username (for example) isn't working, I suspect the problem is with the
Apache conf - check for limits on POST, etc.. maybe? Still shouldn't
generate a parse error tho'....

Cheers,

Alex.

--

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list