views:

366

answers:

4

I want to upload and store video files to my server using PHP. Could any one please provide me the code?

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

A: 

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
Can I upload video files with this function ? But its larger than 200 MB.
Tareq
Go and read the documentation.
Sam152
A: 

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
In my server, I have no permission to change PHP.INIIs there any way to set these values without changing PHP.INI ?
Tareq
Try using : http://us2.php.net/manual/en/function.ini-set.php
Wim Haanstra
ini_set won't work, the upload will have finished being handled by PHP at that point
Tom Haigh
So, I should try ini_set('upload_max_filesize', 5000000); ini_set('post_max_size', 5000000); OK, I'll try it.
Tareq
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
+1  A: 

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
A: 

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