-2

I want to upload and store video files to my server using PHP. Could any one please provide me some example about how to upload a large file using PHP?

Please keep in mind that these files are generally larger than 200 MB.

Tareq
  • 1,999
  • 2
  • 28
  • 57
  • 5
    Instead of asking people for code and to do your work for you, go and try do some research and actually read up on the topic then ask a specific question when you get stuck. – Sam Becker Sep 22 '09 at 12:54

4 Answers4

2

I think the question is fairly limited, is it the post size where there are problems? Uploading files of this size, really should be handled by something else than the normal upload control. You should see if you can give the user a progress on the upload, because otherwise users probably will cancel the upload if it takes too long.

First hit on google: Google search

http://bluga.net/projects/uploadProgressMeter/

Wim Haanstra
  • 5,918
  • 5
  • 41
  • 57
0

Look at this move_uploaded_file, but if it's so big, it needs to be allowed in php.ini to upload this big files. And maybe you will have problem with Apache as well, because default time when it disconnects you is 5 minutes.

martin.malek
  • 2,166
  • 2
  • 19
  • 31
0

You will need to edit PHP.INI and change those two parameters:


upload_max_filesize = 500M
post_max_size = 500M

...for a maximum upload filesize of 500MB.

Havenard
  • 27,022
  • 5
  • 36
  • 62
  • In my server, I have no permission to change PHP.INI Is there any way to set these values without changing PHP.INI ? – Tareq Sep 09 '09 at 06:27
  • 1
    ini_set won't work, the upload will have finished being handled by PHP at that point – Tom Haigh Sep 09 '09 at 06:34
  • So, I should try ini_set('upload_max_filesize', 5000000); ini_set('post_max_size', 5000000); OK, I'll try it. – Tareq Sep 09 '09 at 06:35
  • 1
    No, it won't work. The script don't even start running before the whole file is received, so when this ini_set run it will be already late. – Havenard Sep 09 '09 at 13:06
0

If you have a properly set-up server you can put php.ini files into your htdocs root, and it will be effective.

Cem Kalyoncu
  • 14,120
  • 4
  • 40
  • 62