Bruce Gust
asked on
Why does this if statement not work?
Here's my code:
$filecheck = basename($_FILES['mp3_file ']['tmp_na me']);
// this will return whatever is past the final . in the file name
$ext = strtolower(substr($fileche ck, strrpos($filecheck, '.') + 1));
if (strtolower($ext) == 'mp3') {
echo "mp3";
}
The file in question is an mp3, but the code doesn't recognize that and I need to fix it. How?
$filecheck = basename($_FILES['mp3_file
// this will return whatever is past the final . in the file name
$ext = strtolower(substr($fileche
if (strtolower($ext) == 'mp3') {
echo "mp3";
}
The file in question is an mp3, but the code doesn't recognize that and I need to fix it. How?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hey guys!
I figured it out. The tmp_name thing is what was messing things up. Once I inserted that into the equation, I got what I needed. However, I'm still not where I need to be and if you're interested, head out to this question: https://www.experts-exchange.com/questions/26970736/Why-isn't-this-file-uploading.html and you can help me figure out why although my path and file type are correct, the mp3 file isn't uploading.
Rock on!
I figured it out. The tmp_name thing is what was messing things up. Once I inserted that into the equation, I got what I needed. However, I'm still not where I need to be and if you're interested, head out to this question: https://www.experts-exchange.com/questions/26970736/Why-isn't-this-file-uploading.html and you can help me figure out why although my path and file type are correct, the mp3 file isn't uploading.
Rock on!
I have posted a better way to get files extension, why did you accepted "NOT A SOLUTION" comment such as #35442341 and didn't accepted my solution while it's helpful for other people?
http://php.net/manual/en/function.pathinfo.php