473,657 Members | 2,492 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php file upload - (large file size) - (blank page, no error)

3 New Member
I am having difficulty uploading some large files using php/html form. The code has worked for file sizes up to 23MB. When I've tried a 50MB file, i get a blank page instead of my confirmation echo statement. My web research indicates that I needed to alter some php directives either in an .htaccess file or php.ini. I have edited my php.ini file and included all the relevant directives I could find. Here are the newly added lines. I have confirmed the changes with a phpinfo() request. This problem was posted here but it doesn't appear as if any solution was reached.

memory_limit = 210M
post_max_size = 200M
upload_max_file size = 190M
max_input_time = 2400
max_execution_t ime = 2400
I don't even think max_execution_t ime is even relevant here, but it has been mentioned on several web pages.

Relevant form code:
Expand|Select|Wrap|Line Numbers
  1.  <form enctype="multipart/form-data" method="POST" action="uploader.php">
  2.         Choose a file to upload: <input name="userfile" type="file" /><br />
  3.         <input type="submit" value="Upload File" /><br />
  4. </form>
Relevant script code:
Expand|Select|Wrap|Line Numbers
  1. error_reporting(-1);
  2. if (move_uploaded_file($_FILES['userfile']['tmp_name'], 'uploads/FreeAudio.mp3'))
  3.     echo "File is valid, and was successfully uploaded.\n";
  4. else echo "Error when uploading file\n";
What am I missing?
Feb 6 '10 #1
7 7123
Atli
5,058 Recognized Expert Expert
Hey.

Is display_errors enabled in your PHP.ini?
I ask because if it is not, no errors will be displayed regardless of how you set error_reporting.

The only Apache settings I know of that would cause it to reject files are the "LimitRequestBod y" directive and possibly "RLimitMem". You may want to search your .conf and .htaccess files for those.
Feb 6 '10 #2
rshgeneral
3 New Member
Display errors is set to On. I had read about the LimitRequestBod y online, but I don't know how to check what it is currently set to. My host is GoDaddy, its a Linux shared hosting account. Can those two directives be set in the php.ini file? If so what values should I used. I don't need to post files via HTTP much any bigger than 150-200MB.
Feb 7 '10 #3
Atli
5,058 Recognized Expert Expert
You can't set Apache directives through PHP. At least not these. The PHP code wouldn't be executed until after the uploaded file had been rejected by Apache.

Seeing as you are on a shared environment, I would check with the host. See if they are putting limits on the amount you can upload. - I would guess that most hosts would limit it to a few MiB, for performance reasons.

Event though I doubt they would give you control over these sort of limits, you could try creating a .htaccess file and set them anyways.
Feb 7 '10 #4
rshgeneral
3 New Member
Changing the tmp_upload_dir from the default, which was a the shared /tmp off of root, to a directory underneath my user directory fixed the issue. I'm not sure why this works, but it does.
Feb 9 '10 #5
Atli
5,058 Recognized Expert Expert
OK, I see. That I would not have guessed.
I have heard of uploads failing using the default temp directory (on Windows mostly), but that has always completely disabled it, not partially.

But anyways, I'm glad you got it fixed :)
Feb 9 '10 #6
mozmel
1 New Member
go to php.ini

and find this configration

; Maximum size of POST data that PHP will accept.
post_max_size = 8M

then change size to other like 128 or 256

thanks
mozmel
from khartoum - sudan
May 17 '10 #7
Atli
5,058 Recognized Expert Expert
Hey mozmel.

This issue has already been resolved a while back, as rshgeneral posted in his last entry. And the config directive you suggested was also a part of the directives mentioned in the original post, which had no effect on the problem.
May 17 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7366
by: smilesinblues | last post by:
Hi, I have to allow my visitors to upload image on my site. I am using the follwoing code to do that: $uploaddir = 'admin/'; $uploadfile = $uploaddir . basename($_FILES); move_uploaded_file($_FILES, $uploadfile); My problem is that I expect them to use same file name, like all of
1
10207
by: lazyadmin | last post by:
I would like to use this code on my website to allow simple file uploads from clients. I would like to restrict the file types they can upload. Can this be done? Any help appreciated. Rod http://www.thelazyadmin.com ASP Code upload_file.asp <% @Language=VBScript %>
6
4327
by: Robert Strickland | last post by:
What is the default file size limit when uploading a file and can the administrator up that limited when needed?
1
2878
by: Nawaz Ijaz | last post by:
Hi All, Just need to know that how can it be possible to upload large file in chunks of bytes. Suppose i have a large file (100 MB) and i want to upload it in chunks (say 20 KB). How can this be done as "Simple html File Upload Control" upload file in one go. That i not want really, I want to upload it to the server from my aspx page in parts/chunks. regards, Nawaz Ijaz.
1
1844
by: Kevin Yu | last post by:
hi All is there any good solution to uploading/passing file as parameter to a web service call? thx Kevin
3
4922
by: J055 | last post by:
Hi How do I tell the user he has tried to upload a file which is too big... 1. when the httpRuntime.maxRequestLength has been exceeded and 2. when the uploaded file is under then httpRuntime.maxRequestLength For point 1. it would be good to at least display a nice error page. IE seems to just display a blank page.
0
1286
by: sandya | last post by:
here is the code i tried string ss; //FileUpload FileUpload1 = new FileUpload(); Label Labeltxt = new Label(); //FileUpload1 = FormView1.FindControl("FileUpLoad1") as FileUpload; FileUpload FileUpload1 = (FileUpload)FormView1.Row.FindControl("UploadMB"); ss = FileUpload1.ID.ToString();
1
1879
by: JJ | last post by:
Is it possible to have a file upload control (either the built in one or to write one) that only allows the user to browse for certina extensions? (i.e. only shows *.gif files for example, when the user opens the browse window?) Just thought I'd ask before I went down that route.....
0
928
by: Bhavan Thejpal | last post by:
hi, in a web application we are building, we have a 'upload file' functionality.I need to check whether the user is uploading a valid word file.( it should be a valid, uncorrputed Word file). How do i do it?
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.