Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2014-03-26
13
391 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 109

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 109

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 39956053
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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 109

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 109

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 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 100 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 109

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 109

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

790 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