special character in filename
| From: | Ole Hornauer | Date: | Sun, 08 Jun 2003 17:14:36 +0000 |
| Subject: | special character in filename | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28431@lists.php.net to get a copy of this message | ||
hi,
since i got my mp3 code somewhat working (was my fault, sorry guys), i
encountered another problem that i simply cant solve on my own.
im scanning mp3 files in a directory to put the data into a mysql
database.
everything works fine except that those files that have inverted commas
(maybe also other special characters?) as part of the filename are being
ignored by the script. i tried to use addslashes() but that didn't help
either. i included a test (echo $dir.$file) to see what exactly would be
inside the variables. but it looked ok.
could anybody give me a hint? i just dont get it.
here is my code. i included mphp3.php from http://res.crea-bmb.de/mphp3/
to scan for mp3 tags:
<?
include("mphp3.php");
mysql_connect("192.168.100.12","user","password") or die ("Keine
Verbindung moeglich");
mysql_select_db("mp3") or die ("Die Datenbank existiert nicht");
scan_dir("mp3/");
echo "Fertig";
function scan_dir($dir)
{
$handle = @opendir($dir);
while ($file = @readdir ($handle))
{
if (eregi("^\.{1,2}$",$file))
{
continue;
}
if(is_dir($dir.$file))
{
scan_dir($dir.$file."/");
}
else
{
$info = New mphp3(2);
echo $dir.$file;
$info->load($dir.$file);
$abfrage ="insert into mp3 (
file,
path,
artist,
title,
album)
values (
'$file',
'$dir',
'$info->v2_artist',
'$info->v2_title',
'$info->v2_album');";
mysql_query($abfrage);
}
}
@closedir($handle);
}
?>