Hi All, Can any on ehelp me out to upload video or Image file in server without change of php.ini file.. file size should be more then 40 MB.. Thanks Sam
You'll need a Java or Flash app on the client side to break the client's file up into chunks. Then just use PHP to save the chunks and combine them when the download has completed.
Well, your PHP script would pass the maximum size allowed to the Java / Flash app. Then the client-side code would: - open the file - break it up into chunks of X bytes (determined by the max sized passed to it) - send the total number of pieces calculated using "ajax" - send each piece as a separate file with an "ajax" request (myfile.mpeg.part01, myfile.mpeg.part02) The PHP client would save each file to a temporary folder. When it finishes receiving the last part, it'd use file operations to open and append each piece to a new file which will become the main file. See?
Here's three ways you can do this. Don't choose more than one way. Insert the following code into your script. ini_set('upload_max_filesize', '100M'); ini_set('post_max_size', '100M'); PHP: Create a file called php.ini in the same directory your script is in. Insert the following code into the file. upload_max_filesize = 100M post_max_size = 100M Code (markup): Create a file called .htaccess in the same directory your script is in. Insert the following code into the file. php_value upload_max_filesize 100M php_value post_max_size 100M Code (markup):
He just wants a simple way to change the upload limit, not to learn Java/Flash and create a whole new upload client in another language: all that just to achieve a simple thing? I'd rather ask my host to change the limit, move to another host or use my method instead of learning a whole new language and making a whole new program just to achieve a simple thing. All you need to do is take five seconds of your time to copy and paste two lines of code.
Hi Sevby, i am using this code.. throught this code i can upload any Doc, txt, pdf, file.. can you help me to upload video, mp3 file. Thanks.. <?php if($x!=' ') { $target = "C:/Program Files/Apache/Apache2.2/htdocs/xx/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; $string = split("/",$target); $x=$string[6]; // $x will show you file name. } else{ echo "There was an error uploading the file, please try again!"; } }
Well I assumed he had tried the ini configs first as he said that he couldn't touch php.ini. Either way, though, I probably wouldn't use that method for the sizes larger than 40MB. 1. Users are impatient and will close the browser or cancel it somehow. 2. There's a chance of it timing out on many web servers. Vanilla HTTP is horrible for file uploads. I wouldn't rely on it for anything large. If you're looking for a fast solution rather than a snazzy one, I would consider using an anonymous FTP account with a Java-based FTP client embedded into your site