RE: file uploads Q?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Børge Holen wrote:
> > On Monday 11 December 2006 20:48, Jochem Maas wrote:
> >> Richard Lynch wrote:
> >>> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> >>>> Is it possible to allow  user pick several images and upload them all
> >>>> at
> >>>> once? (I need to pass the images to a function for the resize). Or do
> >>>> I need
> >>>> to give several browse buttons to allow multiple file uploads?
> >>> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> >>>
> >>>> Also I have seen a application (written with MS tools) that allows
> >>>> user to
> >>>> upload a zip file containing images and the zip is automatically
> >>>> uncompressed to a server disk. Can this be done with PHP also?
> >>> Yes.
> >>> http://php.net/zip
> >> the zip extension is only available in php5.2 (or installable via
> >> pecl).
> >>
> >> another option would to use the exec() function to make a call to
> >> gunzip in order to unpack the contents of the zip file.
> >>
> >> a truely poorman's alternative would be to offer multiple FILE input
> >> fields on the relevant page and check which one's are not empty when
> >> the submission occurs.
> >
> > there is no reason for checking each input.
> 
> is that crack your smoking?


Well considering you are using multiple FILE input fields, when you post the
form all file info is stored in $_FILE array.. So weather or not the user
added a file to the a certain field is irrelevant. For example:

<input name="userfile[]" type="file" size="10"> <--- filled
<input name="userfile[]" type="file" size="10"> 
<input name="userfile[]" type="file" size="10"> <--- filled

You would then parse this with:

for ($i=0; $i<count($_FILES['userfile']['name']); $i++) { 
 <your code here>
}

count($_FILES['userfile']['name']); would be two here 


if you want to make sure user has uploaded three files then just compare to
the count() value.. otherwise just parse the content..

So no I don't think he's on crack mate :)

> > Take a look at my earlier questions with the subject "A general UL
> script" and
> > the replies with various ppl here 'bout the use of $_FILES.
> > This way it will check anything listed in the file(s) input of form(s).
> 
> er, whatever. whose next?
 

Some people generate large amounts of irrelevant crap traffic for nothing
imo :)

Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux