> -----Message d'origine----- > De : Jochem Maas [mailto:[EMAIL PROTECTED] > Envoyé : mardi 12 décembre 2006 14:10 > À : Tim > Cc : php-general@lists.php.net > Objet : Re: [PHP] file uploads Q? > > Tim wrote: > >> 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> > > } > > nice, so basically what your saying is need to check each input. > if you have three file inputs - regardless of what you call them (using > the '[]' gives you a nice array structure to loop) you will have to check > each > one to see whether it 'contains' a *valid* *uploaded* file (or whether the > user uploaded nothing in a given input, or whether an error occured with a > particular file, etc). > > copy/pasting sombody else's file upload handler code doesn't constitute > 'no reason to check each input' - it's simply handing off the input > checking > onto code written by someone else. > Ermm ok, if you say so, thats a standard validation loop i made using info from php.net, so yes i did copy/paste.. MY code..
I never said you don't need to check each file.. Isn't it standard to validate each file against certain parameters? I validate each input as each file uploaded (images) are set to be displayed in a certain fashion on the main page based on weather it is number 0 (main image) number >0 are secondary images that require smaller thumbnails. Secondly my clients want the files displayed in a certain order rather then randomly getting files from a certain directory. I add the file "position" ($i) in the database for correct display order. All depends on the context of which you want to display the files later on.. Thats just my way of parsing it there are many others.. Mine works, its fast, and requires little code rather then bulking my site with costly java applets. > > > > So no I don't think he's on crack mate :) > > either way he's unlikely to be financing said crack habit with the > proceeds > of paid php development. I just made a remark on this, because i believe debate on a certain fashion of coding is valid on this list, comments like yours which have nothing to do with coding and are just a personal opinion maybe expressing your frustration with life are not what I look for on this list. Wasting my time opening a message with these types of remarks is not what I am looking for either. Furthermore these kinds of comments degrade the quality of these lists. And I don't think I am alone in believing this. Regards, Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php