I'm writing a script to upload a bunch of images. The number of images to be uploaded can be defined by the user. I've discovered that, if the total number of images (or total size of all images to be uploaded) exceeds the php ini setting, than the .ini settings must be edited to match or exceed the total number and/or total size of images uploaded.
What I'd like to do is, for example:
$maxSiz = ini_get('upload_max_filesize'); then...
Calculate the KB of all images to be uploaded.
If the total KB of all images to be uploaded exceeds upload_max_filesize, then I'd...
1. can these ini settings be altered on the fly? 2. would apache need to be restarted for the changes to take effect? 3. If these specific ini settings CANNOT be changed on the fly or if apache WOULD need to be restarted, then is there a maximum upload value I should use?
I don't know the specific answer about whether 'upload_max_filesize' can be set within a script, but it seems to me that developers need to realize that uploading via PHP (or any language) has several limitations and 'upload_max_filesize' is only one of them. For example, you also have to deal with the maximum script execution time. On shared hosts, you're unlikely to be able to override these settings.
And while users generally have pretty fast download speeds these days, upload speeds are almost always much slower. Even if you can work around the php_ini settings, one or two users trying to upload a handful of multi-megabyte image files can slow your server to a crawl.
If you really want to provide this capability, you'll probably need a fast dedicated server. Failing that, the best route might be a solution that relies on FTP rather than HTTP. There are some Java applets out there like JUPload that might help.