flaab Posted April 23, 2007 Share Posted April 23, 2007 Hi all =) I'm programming a simple upload file php script. The thing is...it works. But only with small files =S and I need it to be able to receive large files (up to 100 mb if neccesary). Here's the code, pretty simple yet. It just receives a file, checks extension and if correct, updloads it. Uploading a small file works, but if is a large file it fails. Where can i change the max file size allowed to upload to my server? Thanks. <?php /******************************************************* * * DP UPLOADER * Version 0.1 * * Recibe fichero a subir * * Comprueba tamaño y extension * Lo sube a un directorio con el nombre adecuado. * ********************************************************/ /************************* * PROCESO **************************/ if(isset($_POST['submit'])) { /* * CONFIGURACION */ $target_path = "files/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $ALLOWED_EXT = array("mpg","mpeg","avi","qt","mov","txt"); /***************************************** * COMPROBACIONES: * a) De formatos * b) De tamaño *****************************************/ // Capturamos extensión $ext = explode(".", $_FILES['uploadedfile']['name']); $ext = $ext[count($ext) - 1]; if(!in_array($ext, $ALLOWED_EXT)) { $error = "Extension no permitida"; } if(!$error) { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } else { echo $error; } } else { /********************* * FORMULARIO *********************/ ?> <form enctype="multipart/form-data" action="dp_uploader.php" method="POST"> Elige archivo a enviar: <input name="uploadedfile" type="file" /><br /> <input type="submit" name="submit" value="Upload"> </form> <?php Quote Link to comment https://forums.phpfreaks.com/topic/48261-solved-uploading-files-from-multipart-forms-problem/ Share on other sites More sharing options...
LazyJones Posted April 23, 2007 Share Posted April 23, 2007 Hello Server upload limit (and the place to change it) depends on server. Nothing you can do in code Quote Link to comment https://forums.phpfreaks.com/topic/48261-solved-uploading-files-from-multipart-forms-problem/#findComment-235908 Share on other sites More sharing options...
MadTechie Posted April 23, 2007 Share Posted April 23, 2007 place to chage is the php.ini (isn't it?) Quote Link to comment https://forums.phpfreaks.com/topic/48261-solved-uploading-files-from-multipart-forms-problem/#findComment-235915 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.