bynor Posted June 22, 2010 Share Posted June 22, 2010 Hello there, i got a problem uploading Mp3 files, i use this Form: <form enctype="multipart/form-data" method="post" name="carica" action="car1.php"><tr> <td><font color="#990000">Nome Canzone: </td><td><input type="text" name="use"></td></tr> <tr><td><font color="#990000">Nome Artista: </td><td><input type="text" name="art"></td> <tr> <td> <input name="uploaded" type="file" /></td><td><input type="submit" value="Caricare canzone" name="car"></td></tr> </form> and this Php : $target = ""; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "il file ". basename( $_FILES['uploaded']['name']). " e stato caricato."; } else { echo "Errore nel caricamento."; } Now the problem is that the code WORKS for .jpg but DOESNT for mp3, the error i get is the following: Notice: Undefined index: uploaded in E:\web\MusicStore1\car1.php on line 18 Notice: Undefined index: uploaded in E:\web\MusicStore1\car1.php on line 20 where the lines are: $target = $target . basename( $_FILES['uploaded']['name']) ; and if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) respectivly Thank you in advance Link to comment https://forums.phpfreaks.com/topic/205504-problem-uploading-mp3-files/ Share on other sites More sharing options...
inversesoft123 Posted June 22, 2010 Share Posted June 22, 2010 open php.ini and check these parameters, memory_limit = 210M post_max_size = 200M upload_max_filesize = 190M max_input_time = 2400 max_execution_time = 2400 Link to comment https://forums.phpfreaks.com/topic/205504-problem-uploading-mp3-files/#findComment-1075385 Share on other sites More sharing options...
bynor Posted June 22, 2010 Author Share Posted June 22, 2010 yay it works, thank you very much, i only modified the max_upload_size, but looks like it wasn't enough. Thanks again Link to comment https://forums.phpfreaks.com/topic/205504-problem-uploading-mp3-files/#findComment-1075390 Share on other sites More sharing options...
PFMaBiSmAd Posted June 22, 2010 Share Posted June 22, 2010 You are probably exceeding the post_max_size setting, in which case the $_FILES array is empty and $_FILES['uploaded'] won't exist - http://us3.php.net/manual/en/ini.core.php#ini.post-max-size You must always validate data that comes from a visitor. In the case of an uploaded file you must test if $_FILES is not empty before attempting to process any of the uploaded file information. You must also test $_FILES['uploaded']['error'] to check for other errors that can occur (such as exceeding the upload_max_filesize) - http://us3.php.net/manual/en/features.file-upload.errors.php Link to comment https://forums.phpfreaks.com/topic/205504-problem-uploading-mp3-files/#findComment-1075392 Share on other sites More sharing options...
bynor Posted June 22, 2010 Author Share Posted June 22, 2010 thats true, when i tried checking the contents of the array using print_r($_FILES); it was always empty when the file was an mp3. Link to comment https://forums.phpfreaks.com/topic/205504-problem-uploading-mp3-files/#findComment-1075394 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.