Large PHP File Uploads

Posted on 2009-04-29
Medium Priority
Last Modified: 2012-05-06
I need to upload larger files using php(30mb+) .  I have found a decent amount of info on this, but I can't seem to make it work for me.  I'm not sure what all I need to include in order for you guys to help, but I'll throw in what I think is necessary, and we can go from there.  I have two pages.  One that accepts the file input, and one that actually handles the files.  I'm going to document the info in my pages in the code section of this post, and I am attaching a copy of my php.ini file(I had to rename it to .jpg, so you'll have to change it back to ini).  I should mention that my script appears to execute without a problem, but the actual uploaded file is never moved to the correct directory. On smaller files, everything works as it should.  What am I doing wrong? If I need to provide any additional info, please let me know.  Thanks for reading.
//Here's a snippet from the form page
<FORM METHOD="post" ACTION="sendvreal.php" ENCTYPE="multipart/form-data" >
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
<INPUT TYPE="file" NAME="Pic1"  ALLOW="text/*" onFocus="doClear(this)" >
//Here's a section from the page "sendvreal.php"
move_uploaded_file($pic1['tmp_name'], "images/".$pic1['name']);
//Currently, a large file will not move into the images directory, this is what I need to resolve.

Open in new window

Question by:thedeal56
  • 2
LVL 15

Accepted Solution

babuno5 earned 2000 total points
ID: 24262499
you have done all the right things for large file uploads

Are u getting any error messages in the error log when uploading a large file

Author Comment

ID: 24262841
Thanks for the fast reply

I checked the log, and I found this:
[29-Apr-2009 09:51:43] PHP Warning:  POST Content-Length of 34344016 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

I tried to recreate the error by uploading another large file, but it did not recreate itself.

Author Comment

ID: 24263454
I was finally able to produce this error:

[29-Apr-2009 12:55:55] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 26937095 bytes) in C:\wamp\www\Prop\class.smtp.php on line 371

I changed the memory size from 128M to 500M.  My pictures are moving to the folder now.  The next step in the process was to attach the files to an email.  The email part was in place before I knew how big the files were going to be, so now I will just provide a link to the folder where the files reside.  Just out of curiosity, is there a way to make phpmailer attach files larger than 30mb?  The mail server that I'm using has no file size limitation.  Thanks.

Featured Post

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.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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

569 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