?
Solved

HTML Forms - File Browser - Form wont submit when including a large PDF (>30MB)

Posted on 2014-03-26
13
Medium Priority
?
400 Views
Last Modified: 2014-03-26
At the moment I have a very basic html form - it has 4 form fields (file-pickers) and a submit button.

If I submit the form with no files selected, it continues to the next page.
If I add a small (2MB) file into one of the file pickers and submit the form, it continues to the next page.
If I add a large (32MB) file into one of the file pickers and submit the form, it never leaves the page (the 'working' icon spins around in IE, but it never actually proceeds).

This problem appears to be relevant on the form page only (not the form processor) - I've changed the form action to a page that does not exist - and the outcome is the same in all 3 scenarios listed above,

Any ideas on how to fix this?

Thanks
0
Comment
Question by:Bergstr
  • 6
  • 6
13 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39955849
Excerpted comments form my teaching examples:

// MANUAL REFERENCE PAGES YOU MUST UNDERSTAND TO UPLOAD FILES
// http://php.net/manual/en/features.file-upload.php
// http://php.net/manual/en/features.file-upload.common-pitfalls.php
// http://php.net/manual/en/function.move-uploaded-file.php
// http://php.net/manual/en/reserved.variables.files.php

// MANUAL PAGES THAT ARE IMPORTANT IF YOU ARE DEALING WITH LARGE FILES
// http://php.net/manual/en/ini.core.php#ini.upload-max-filesize
// http://php.net/manual/en/ini.core.php#ini.post-max-size
// http://php.net/manual/en/info.configuration.php#ini.max-input-time

Open in new window

I would consider 32MB to be a large file.  Can you please post your HTML upload form?  I'd like to install it and try it myself.
0
 

Author Comment

by:Bergstr
ID: 39956001
I've reduced the page down to 1 field and 1 submit button, and still experience the problem. The full page is below.

I don't think this is related to the PHP controls - at this point there is no php - when it gets through to the processor, php will come into play - but I already have other code working fine using similar style forms, and then having PHP validation and upload processes - The problem seems to start when you start uploading large files as it wont even submit the data, so we don't even get to the validation stage.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="TEST.PHP" enctype="multipart/form-data">
  <input type="file" name="NewCat" id="NewCat" />
  <br />
  <input name="Submit" type="submit" value="Submit" />
</form>
</body>
</html>

Open in new window


Thanks
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1600 total points
ID: 39956053
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Bergstr
ID: 39956224
They were:

upload max filesize: 50M
post max size 8M
Max input time: 60

Just updated these to 50M / 50M / 240, restarted and I'm now retrying the upload... will let you know the outcome in a few minutes!

Thanks
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39956248
Makes sense to increase the values.

You may also need something in the HTML form.  I've used something like this in my upload forms.

<input type="hidden" name="MAX_FILE_SIZE" value="$max_file_size" />

The variable is a decimal number, like maybe 50000000 (== 50,000,000)
0
 

Author Comment

by:Bergstr
ID: 39956256
almost 10 mins later and IE is still showing the form field, and the loading icon is still spinning around.

Do I need to increase the Max_input_time to a higher figure?

As a note, I can upload that file from my PC to the server in less than 30 seconds using FTP, so I don't think its down to a slow connection or anything like that.

Thanks
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39956339
Can you try it in Firefox or Chrome?  I don't usually recommend uploading a 50MB file via HTTP, but it might be interesting to see if another browser is capable.
0
 
LVL 35

Assisted Solution

by:Dan Craciun
Dan Craciun earned 400 total points
ID: 39956441
I think you need to increase post_max_size to be at least 50M.

post_max_size integer
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.
From the manual here: http://www.php.net/manual/en/ini.core.php#ini.post-max-size

HTH,
Dan
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39956530
Dan: Yeah, I think we're trying that now.  Also, 50M is not the same as 50,000,000 bytes, so setting the size to something exact may not be as good as setting the size to something that is obviously larger than the largest file size.

PHP is an old language, and these artificial restrictions don't make as much sense any more.
0
 

Author Comment

by:Bergstr
ID: 39956603
I think by changing these settings, we've broken php!!

A quick google says that setting post_max_size to the same value as upload_max_filesize stops $_POST from working at all!

I'm now moving from the form page to the processor, but the processor is acting like it has no data.

Need to make some more config changes, get this problem solved and hopefully things will start working!
0
 

Author Comment

by:Bergstr
ID: 39956633
Note: post_max_size must be set to a lower value than upload_max_filesize, or $_POST stops working completely.

They have now been changed to 60M & 50M - the script is now working for smaller files! Just tried running a 30MB file so we'll see how this goes. It appears to go through after around 10-15 mins.
0
 

Author Comment

by:Bergstr
ID: 39956676
it works! a little bit slow (takes around 10~15 mins to upload 30mb), but it does upload the file!

Thanks very much for your help.
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 39956752
On my server, I have post_max_size=108M and upload_max_filesize=102M.  No problems of any sort.

But in any case, glad you've got it working and thanks for the points, ~Ray
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question