mikhell Posted December 13, 2010 Share Posted December 13, 2010 Hi all ! I have real problems to upload an mp3 from a upload script i have made... I made it with a tutorial and it works very well for pictures but not for mp3... Can you help me plz <?php //changement de la taille dans le php.ini $new_size = '100M'; $new_limit = '100M'; @ini_set('post_max_value',$new_limit); @ini_set('upload_max_filesize',$new_size); //propriétés du fichier uploader //nom du fichier uploader $nomFichier = $_FILES['fichier']['name']; //type du fichier uploader $typeFichier = $_FILES['fichier']['type']; //grosseur du fichier uploader $sizeFichier = $_FILES['fichier']['size']; //dossier temporaire $tempFichier = $_FILES['fichier']['tmp_name']; //erreurs $erreurs = $_FILES['fichier']['error']; echo $typeFichier; //dossier de destination $destination = "uploaded/"; //condition $typeVoulu = 'audio/mpeg'; $sizeVoulu = 300000000; //regarder si il y a des erreurs if($erreurs > 0){ die('incapable de televerser le fichier! Code '.$erreurs); }else{ //condition pour uploader le fichier //regarder le type de fichier if($typeFichier == $typeVoulu){ //regarder la grosseur du fichier if($sizeFichier <= $sizeVoulu){ move_uploaded_file($tempFichier, $destination.$nomFichier); echo $sizeFichier; echo "Televersement complet"; }else{ echo $sizeFichier; die('Grosseur du fichier incorrect !'); } }else{ echo $typeFichier; die('Type de fichier incorrect !'); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2010 Share Posted December 13, 2010 You cannot set post_max_size or upload_max_filesize in a script (they must be set before the script is executed) and you forgot to tell use which error message you are getting. Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/#findComment-1146449 Share on other sites More sharing options...
mikhell Posted December 13, 2010 Author Share Posted December 13, 2010 Sorry for my miss... my error is the type isnt correct... and i have change the 2 things in the php.ini Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/#findComment-1146450 Share on other sites More sharing options...
mikhell Posted December 13, 2010 Author Share Posted December 13, 2010 i got error code 1 too Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/#findComment-1146454 Share on other sites More sharing options...
mikhell Posted December 13, 2010 Author Share Posted December 13, 2010 how can i change upload_max_filesize in php.ini of my ftp ? and can i do it in code Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/#findComment-1146455 Share on other sites More sharing options...
mikhell Posted December 13, 2010 Author Share Posted December 13, 2010 i have change the good php.ini... but it doesnt work... Quote Link to comment https://forums.phpfreaks.com/topic/221462-problem-with-uploading-mp3/#findComment-1146464 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.