Mp3 file upload problem

Thread Solved

Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster

Mp3 file upload problem

 
0
  #1
28 Days Ago
Hi frnds...


i m trying to upload mp3 file ..this is my code..

upload_max_filesize = 20M;//in php.ini
  1. $tname = $_FILES["tphoto"]["name"];
  2. $ttmp_name = $_FILES["tphoto"]["tmp_name"];
  3.  
  4. //Audio File Uploading....
  5. if($_FILES['tphoto']['type'] == 'audio/mpeg'){
  6. $dir="../../music/$aid";
  7. move_uploaded_file($ttmp_name,"$dir"."/"."$tname");
  8. }

it displays no error...but, no output.

can any body give me some suggestion plz...

Thanks in advance...
Sari K
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 527
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 61
network18 network18 is offline Offline
Posting Pro
 
0
  #2
28 Days Ago
check if this is in your form -
enctype="multipart/form-data"
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #3
28 Days Ago
Originally Posted by network18 View Post
check if this is in your form -
enctype="multipart/form-data"

Hi ,

Thanks 4 ur reply...

it works fine for all (images, WMA)....when i change the below code..

  1. $_FILES['tphoto']['type'] == 'audio/wma'
....


prob only for MP3 files...
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 527
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 61
network18 network18 is offline Offline
Posting Pro
 
0
  #4
28 Days Ago
if you check against that type only, its obvious that script will allow only that file type.
Maybe you are looking for "audio/x-mpeg-3" as file type.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #5
28 Days Ago
a
Last edited by sarithak; 28 Days Ago at 3:13 am.
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #6
28 Days Ago
Originally Posted by network18 View Post
if you check against that type only, its obvious that script will allow only that file type.
Maybe you are looking for "audio/x-mpeg-3" as file type.

hi

file type= "MP3 formate sound";
//file type ..

i need to allow only MP3 FILES.....

Is there any other parameters change in PHP.INI??...
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 527
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 61
network18 network18 is offline Offline
Posting Pro

Filetype audio/mp3

 
0
  #7
28 Days Ago
Originally Posted by sarithak View Post
a
then why you not using straightaway
$_FILES["file"]["type"] == "audio/mp3";
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #8
28 Days Ago
Originally Posted by network18 View Post
then why you not using straightaway
$_FILES["file"]["type"] == "audio/mp3";

Hi ..

I m sorry....

when i m write the if condition..its not working for all types..
  1. if (($_FILES["tphoto"]["type"] == "audio/wma")){

with out condition it works fine except for MP3....
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 527
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 61
network18 network18 is offline Offline
Posting Pro
 
0
  #9
28 Days Ago
By using this "if loop " , you actually what is the file type, and if the file type is the specified one then allow the process else do something else.
I think why to use it, must be clear to you by this now.
And you saying when you not using this if loop you are able to upload all the files except the MP3, maybe with this MP3 file you are violating the file size limit.
echo your file element and post it's contents here with this file
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 149
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #10
28 Days Ago
Hi ..


now i m trying for 5 mb MP3 file...its uploaded perfectly....So, the prob with file size...but in my php.ini

upload_max_size=20M
plz tell me wat i have to do...

Thanks a lot..
Last edited by sarithak; 28 Days Ago at 3:51 am.
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC