All Things Web 2.0
19 Sep
Let me first start by saying that I’m currently working at a startup, and for anyone who’s ever done this, you know it sucks up a LOT of your time… in my case pretty much all of it. I’m not complaining by any means, I’m doing some of the coolest work I’ve ever done in fact! However, I just wanted to explain my little posting hiatus…
Anyway, on to the matter at hand. I have found myself in a position where I am writing scripts that may need to upload fairly large files. My scripts were timing out, and I couldn’t seem to figure out why. For the unitiated, there are some standard things that you usually do to both your php.ini and in your script in this situation:
However, it turns out there are some other php.ini config variables that you may need to look at:
That’s about it! Quick and simple solution to a problem that is probably pretty common.
13 Responses for "Uploading Large Files With PHP"
Pretty good work! I found myself in the same boring situation and reached the shore doing exactly what you describe in this post… But what if sizes are really large? I.E. : 50M. How can we implement a systerm that allows such an upload without crash our system?
Hey thanks for this.
I was having the same issue.
I changed the max_upload_size but not the others. Stupid how they rely on each other. But it works now!
Very useful, thanks. There are several articles out there for “large uploads via PHP” but they seem to only have partial settings mentioned.
It’s very important that post_max_size is > max_upload_size. If only by a small amount.
I’m in the process of setting up an app that will need to allow uploads up to 500M. — Lorenzo, follow these instructions and you should be ok. Also make sure to set in your form (where value= whatever size you need in bytes)
im still troubled and cant get my uploader work. still uploads only below 2M my hosting is 1and1 and i cant make it work ‘duh!’
Thank you very much! This article solved all my problems!
where do you put the php.ini file?
Nice Article, Just followed each steps that are given here, I got the output correctly, Thanks a lot again.
You can find the php.ini file in BIN folder, all you need to do is, change the max post size and max upload file size in your ini file
This article is just what I needed - right to the point and thorough… I applied what it said in my php.ini file, and it worked like a charm (the post_max_size threw me off too)
Create on php.ini file in your root with only the settings for adjusting file limits, then log into shell and create symbolic links to php.ini inside of any folder and sub folder that contains pieces of the upload script and files uploaded.
My previous post was to insic about 1and1 hosting. Forgot to mention that.
I edited the php.ini to what you say and I’ve no problem in uploading small files. Although I have when I upload files>1.xMB (even if limits are set to 6-7 MB).
Any help anybody?
Alex,
do you use MAX_FILE_SIZE directive in your form?
Leave a reply