Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a modern, robust file uploader, multiple files with text fields

Status
Not open for further replies.

cmayo

MIS
Apr 23, 2001
159
US
I have an ancient PHP multi-file upload form & script that's become something of a problem. It's fine for uploading relatively small files (50mb), but chokes on anything much larger, even with upload_max_filesize() bumped as high as 5gb.

When it chokes on larger files, I don't see any errors in the browser or the error_log, the file being uploaded just vanishes. I host with a budget shared hosting outfit, so I don't have a lot of access to the system beyond php.ini & .htaccess, etc., so I'm kind of at a loss to figure out what's happening.

The form I'm using is shown in the attachment, but basically I need multiple upload slots and a way to associate multiple form fields (user-input file description, a couple SELECT's and checkboxes, etc..) with each file being uploaded for post processing.

I'm looking at a jQuery library ( that's pretty bulletproof when uploading files of any size, but I know squat about jQuery and all the demos pretty much just throw a bunch of files in a single bucket and don't seem to support any per file annotations or other form-type data.

Given my lack of jQuery experience, it's going to be a major hassle to even figure out whether I can adapt that jQuery engine for my purposes.

Can someone suggest either a robust, falut-tolerant PHP uploading class that I can use with my present code, or more modern Javascript/jQuery/Ajax/Whatever method that lends itself to my multi-file-with-extra-data requirements?
 
Php doesn't upload. It is server side only. It will take whatever the browser gives the webserver and the webserver is allowed to take.

If you are on shared hosting then there may be webserver limits that prevent you getting files. Equally there are parameters within php that limit what you can receive. Many of these musr be set in php.ini rather than at runtime which may prevent you having control over them. Setting browser side directives will have no unlimiting effect on server side constraints of course.

So whatever upload interface you use your receiving system must be configured to handle it. All php (post) receiving scripts ultimately use the same mechanism.
 
Thanks, jpadie. I do have access to php.ini for my domains and that's where I'm setting upload_max_filesize, it's just that larger files are kind of hit or miss.

I couldn't push a 119mb file through our uploader yesterday in five different attempts, today it uploads without incident. When it's failed, it hasn't given a reason.

I guess I'll just keep plugging...
 
you need to set not just the upload max file size but also the post_max_size (should be greater than upload_max_filesize. you should also ensure that the php memory allocation is sufficient for large files.

try logging all file interaction as well. in your fileupload receiver just add the following

Code:
if(isset($_FILES) && count($_FILES) > 0):
 file_put_contents('filelog.txt', print_r($_FILES, true), FILE_APPEND);
endif;

if the php process doesn't have create privileges you may need to create the filelog.txt first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top