Page 1 of 1

MP3 upload problem

Posted: Thu Jun 19, 2008 7:47 am
by Addos

Code: Select all

if ($_FILES['fupload']['type'] == "audio/mpeg")
I'm using the above script to upload mp3 files to a folder but I'm getting
the error that it's the wrong file type. I have access to set permissions
myself and the file path is

Code: Select all

$target = "../../audio/mp3/" 
.$_FILES['fupload']['name'];
Any ideas as to why this is? I have set permissions on both folders where
the file is to be sent.

Thanks

Re: MP3 upload problem

Posted: Thu Jun 19, 2008 9:41 am
by pickle
Your "above" script is just an if condition & does absolutely nothing with moving or uploading files. Some relevant code would be appreciated :?

Re: MP3 upload problem

Posted: Thu Jun 19, 2008 10:30 am
by Addos
Okay here is all the code.
thanks

Re: MP3 upload problem

Posted: Thu Jun 19, 2008 11:13 am
by pickle
Echo $_FILES['fupload']['type'] & see what your files are being uploaded as. It's likely you've just got the wrong mime type in there.

Re: MP3 upload problem

Posted: Sun Jun 22, 2008 10:49 am
by Addos
Thanks for the help.
I have output the following and get

Code: Select all

<?PHP echo $_FILES['fupload']['type'];?> // audio/x-mpeg
<? echo $_FILES['fupload']['name'];?> // song.mp3  
I have searched the net but can't see any other MIME type other than audio/mpeg

Also if I use image/jpeg I can upload this fine so I'm fairly sure that the conditional statements and file paths/permissions are okay.

Any ideas why I can't upload this mp3?
Thanks

Re: MP3 upload problem

Posted: Mon Jun 23, 2008 9:48 am
by pickle
pickle wrote:It's likely you've just got the wrong mime type in there.
Look closer at what the mime type actually is, and what you're checking for.

Re: MP3 upload problem

Posted: Mon Jun 23, 2008 10:03 am
by Addos
"Look closer at what the mime type actually is, and what you're checking for"
thanks for the reply but I'm really not sure how to look closer at what type of mime is as I thought I was checking taht it was a mp3 by using audio/mpeg.
Is there any other script that I can use to output more info on the file I'm trying to upload. I know it's definately an mp3 so any pointers would be great.
thanks :wink:

Re: MP3 upload problem

Posted: Mon Jun 23, 2008 10:25 am
by pickle
The type you're checking for: audio/mpeg.
The type of the mp3: audio/x-mpeg