Solved

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

Posted on 2014-03-26
13
387 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 108

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 108

Accepted Solution

by:
Ray Paseur earned 400 total points
ID: 39956053
0
 

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 108

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 108

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 108

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 108

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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 …

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now