Large PHP File Uploads

Posted on 2009-04-29
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
    LVL 15

    Accepted Solution

    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

    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

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now