check if this is in your form -
enctype="multipart/form-data"
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
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.
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
a
then why you not using straightaway
$_FILES["file"]["type"] == "audio/mp3";
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
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
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
try with another mp3 file having small size and post your entire code here.
and you seem to be confused, first decide which file types you want to restrict and which file types you want to allow.accordingly we will proceed with the code.
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
is "audio/mp3" and "MP3" same for you ?
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
Again you seem to be confused.This time you are having problem with all the file types.
The max size can be set in the php.ini as, search for "upload_max_filesize" .It may have default value of 2MB at the moment edit it to have whatever you like.
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
Hi Network18,
You r correct..at that time it takes all types of files...k leave it...
I am having doubt on "upload_max_filesize" ..how can i change the values in php.ini file(which is located in server)...plz tell me is there any way to do by using coding????
i think this is stupid question, but no chance to me...
Thanks in advance..
Yes, you can do that by function ini_set()-
//This is your new size
$new_size = '3M';
ini_set('upload_max_filesize',$new_size);
most of the properties in the php.ini can be set during runtime using ini_set() function.The new values last there till the script executes.
And don't worry, nothing is stupid, until you don't know it:)
its always good to clarify the doubts here.
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76
hi sir,
This time i m getting warning
i fixed the
$new_size = '20M';
ini_set('upload_max_filesize',$new_size);
the uploading file size is 9 to 10 MB...
Does it solve your problem..you can supress any warning with prefixing '@' to the function like @ini_set(), eventhough i never recommend doing that.
network18
Practically a Master Poster
619 posts since Sep 2009
Reputation Points: 29
Solved Threads: 76