[PHP] Uploading multiple files?

Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,983
Reaction score
3
Hi,

Is there a way, in PHP, to upload multiple files (ie: the content of a whole directory) from the client to the server? Because the html tag <input> with the attribute/value type="file" can only select a file, not a directory. So, is there a way to upload multiple files, where users select the directory instead of 20 files to upload...

Thanks,

Daevius
 
That zip idea is great! Thanks, stupid that I haven't thought that up lol. Not sure what you mean with the JavaScript part...and I'm not sure if WebDAV will work...

Thanks,

Daevius
 
A website must NEVER be allowed to just 'read' the entire contents of a directory on a client computer - this would be a huge security-risk.

There are ActiveX plugins that can, and you can use some javascript to continue to give the user a file-input dialogue, though that might be rather anoying.
 
Yeah, I know PHP can and shouldn't read client info. The zip/rar solution works...although 'upload_max_filesize' in php.ini should be somewhat higher than 2MB if you want to upload multiple files...can't do much against that ^^.

Thanks for the replies :)

Daevius
 
Yes, its no problem for myself. Its that users are lazy and hate software where they have to modify "system" files. OR they dont have access to it: You rent a domain + hosting and you have the upload problem, you cant just change the php.ini file of the complete hosting server :P. The hoster would never allow, because it affects all sites.

I guess FTP or single file upload is the only way....

Thanks for the reply though :)

Daevius
 
Well, as stated, there are other options. I know of plenty of sites with foto-upload capabilty that use ActiveX components to let you select an entire directory, though as I've never written one myself I do not know how difficult that is going to be.

Personally I tend to demand user write some title for each foto, makes them think twice before just uploading any crappy pic they took, doesn't hurt them in my opinion :wink:
 
Back