Page 1 of 1

Upload Script, NO size restriction!

Posted: Fri Sep 29, 2006 2:52 pm
by JustinMs66
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!?

Code: Select all

<?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!";
    }
}
}
?>

Posted: Fri Sep 29, 2006 3:06 pm
by Burrito
you need to look in your php.ini file and change two settings:

max_post_size

and max_file_upload (or something like that)...just do a search for max and you'll find them both.

Posted: Fri Sep 29, 2006 3:09 pm
by JustinMs66
php.ini?
i don't have that file.
or is it somewhere on the server?

Posted: Fri Sep 29, 2006 3:10 pm
by Burrito
it's on the server.

Posted: Fri Sep 29, 2006 3:12 pm
by JustinMs66
where!??

Posted: Fri Sep 29, 2006 3:14 pm
by Luke
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.

Posted: Fri Sep 29, 2006 3:17 pm
by Burrito
in windows it's usually in the %systemroot% folder ie (C:\windows)

in *nix it varies depending on how you have your server configured.

on our server it's located here:

/usr/local/lib/php.ini

Posted: Fri Sep 29, 2006 4:44 pm
by waradmin
Isnt there code to override the max-upload php.ini limit?

If not, use a Javascript applet that does it over FTP.

Posted: Fri Sep 29, 2006 5:03 pm
by Luke
waradmin wrote:Isnt there code to override the max-upload php.ini limit?

If not, use a Javascript applet that does it over FTP.
don't you mean java applet?

Posted: Sat Sep 30, 2006 8:38 am
by miro_igov
@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.