Hi
I am doing a simple php file upload script. Works fine but I cant upload more than 3MB files using this script... Please help me. This is my code

$target_path = "../items/";
$target_path = $target_path . basename( $_FILES['file1']['name']); 
$name=$_FILES['file1']['name'];
$ext=end(explode('.',$name));
if ($ext=="flv"){
move_uploaded_file($_FILES['file1']['tmp_name'], $target_path);
$new_name=$itemId.".".$ext;
rename ("../items/".$name, "../items/".$new_name); 

mysql_query("UPDATE video SET video='$new_name' WHERE id='$itemId'");
}

Thanks in advance
Rajeesh

Recommended Answers

All 2 Replies

Works fine but I cant upload more than 3MB files using this script

refer to the following:
http://us2.php.net/manual/en/features.file-upload.post-method.php

specifically,

...The MAX_FILE_SIZE hidden field (measured in bytes) must precede the file input field, and its value is the maximum filesize accepted by PHP...

alternatively, if you have access to your php.ini file look for:
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

and try increasing it.

I think the upload_max_filesize should be increased in the php.ini or in the .htaccess file. It would be too late to apply the limit in the php because the upload has already been processed or discarded...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.