Jump to content

Problem with uploading mp3


mikhell

Recommended Posts

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 !');
	}
}


?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.