Solved

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

Posted on 2014-03-26
13
390 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

809 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