delete extension from filename

A

Anonymous

Guest
Hi!

When you do the test to know whether it is a .jpg file or not, you use the function substr...
substr returns a string but does not alter the string you pass as an argument.
In other words, calling substr($nomfichier, -3) will not change anything in the variable $nomfichier... And when you use it later, you will therefore still have the full name with the extension...

To solve the problem, try like this
Code:
$fichiers .= ",".substr($nomfichier, 0, strlen($nomfichier) - 4); // I guess you do not want the dot either...

There is another thing, you should perhaps be sure that the file you are currently processing is not a directory with the function is_dir...

/Flood
 
Back
Top