PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i have a working php upload script, but it only allows about up to 7MB and then it just goes to the error.
i want it to NOT have ANY size restriction. but i havn't restricted any sizes!!!!
can anyone help me with this!?
<?php
//restricting file types i don't want to be uploaded:
$bad_types = array('application/octet-stream','application/x-php');
//if it's a bad file type, then display error:
if( in_array( $_FILES['uploadedfile']['type'], $bad_types ) )
{
echo "That File type is not supported.";
}
else
{
//otherwise continue on the upload:
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
{
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "your file HAS been uploaded!";
} else{
echo "There was an error uploading the file, please try again!";
}
}
}
?>
are you on a shared host? If so, you don't have access to it... you have to talk to your hosting company and there's no way any shared host on this planet is going to allow you to upload any size file you like... they may bump it up if you're lucky.
@waradmin
You can't set max_post_size or max_upload_size with ini_set because the upload starts and completes before the first line of the script to be executed.