943,983 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 5112
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 4th, 2009
0

Mp3 file upload problem

Expand Post »
Hi frnds...


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

Quote ...
upload_max_filesize = 20M;//in php.ini
PHP Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008
Nov 4th, 2009
0
Re: Mp3 file upload problem
check if this is in your form -
enctype="multipart/form-data"
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Mp3 file upload problem
Click to Expand / Collapse  Quote originally posted by network18 ...
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..

PHP Syntax (Toggle Plain Text)
  1. $_FILES['tphoto']['type'] == 'audio/wma'
....


prob only for MP3 files...
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008
Nov 4th, 2009
0
Re: Mp3 file upload problem
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.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Mp3 file upload problem
a
Last edited by sarithak; Nov 4th, 2009 at 3:13 am.
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008
Nov 4th, 2009
0
Re: Mp3 file upload problem
Click to Expand / Collapse  Quote originally posted by network18 ...
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

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

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

Is there any other parameters change in PHP.INI??...
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008
Nov 4th, 2009
0

Filetype audio/mp3

Click to Expand / Collapse  Quote originally posted by sarithak ...
a
then why you not using straightaway
$_FILES["file"]["type"] == "audio/mp3";
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Mp3 file upload problem
Click to Expand / Collapse  Quote originally posted by network18 ...
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..
PHP Syntax (Toggle Plain Text)
  1. if (($_FILES["tphoto"]["type"] == "audio/wma")){

with out condition it works fine except for MP3....
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008
Nov 4th, 2009
0
Re: Mp3 file upload problem
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
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009
Nov 4th, 2009
0
Re: Mp3 file upload problem
Hi ..


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

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

Thanks a lot..
Last edited by sarithak; Nov 4th, 2009 at 3:51 am.
Reputation Points: 10
Solved Threads: 7
Junior Poster
sarithak is offline Offline
183 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Update db
Next Thread in PHP Forum Timeline: url mod writing not working properly





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC