Error uploading large files

General discussion on PHP
Post Reply
malayilalex
Posts: 2
Joined: Tue Apr 07, 2009 10:57 pm

Error uploading large files

Post by malayilalex » Tue Apr 07, 2009 11:01 pm

Hi friends,

I have a problem like i am trying to upload some big files like 3.5 mb audio and video files but it makes errors like max file size exceede..
i changed php.ini fields like upload_max_filesize,post_max_size etc..but it doesn't make work..i searched lot in internet for the help but doesn't work finally i came up here...can anybody help me to solve this...i am usig wamp....

regards
alex.

tklinn
Posts: 17
Joined: Mon Mar 30, 2009 8:30 am
Location: Singapore

Re: Error uploading large files

Post by tklinn » Wed Apr 08, 2009 6:31 am

Hi,

Try this coding, Please remember 8MB is max.

upload.php

Code: Select all

<form enctype="multipart/form-data" action="upload_ac.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
Choose a file to upload: <input name="uploadedfile" type="file" />
<input type="submit" id='upload' name='upload' value="Upload File" />
</form>
upload_ac

Code: Select all

<?php
 
$target_path = "../";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

	if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path) && $_POST['upload']) {
		echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
		" has been uploaded";
	} 
	else{
		echo "There was an error uploading the file, please try again!";
	}
?>
Thanks & Best Regards,
Thet Kyaw Linn

Post Reply