Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

how do you open a file with quote marks in the file name o..

 
   Database Forums (Home) -> PHP RSS
Next:  Large Database System  
Author Message
lawrence k

External


Since: Jul 06, 2007
Posts: 11



(Msg. 1) Posted: Thu Oct 18, 2007 5:38 pm
Post subject: how do you open a file with quote marks in the file name on Linux?
Archived from groups: comp>lang>php (more info?)

I've got a client that is a music studio and they've several thousand
mp3s that tend to have file names like this:

Adrian Orange - Bitches Is Lord - 13 - Don't Get Used To It.mp3

The quote mark in that file name is giving me trouble.

The music studio asked me to write a script that could read all the
metadata out of their mp3s and then store the info in a database.
Using the getID3 library, I've had an easy time with all the files
that don't have quote marks in their names:


require_once('../getid3/getid3/getid3.php');
$getID3 = new getID3;

for ($i=0; $i < count($formInputs); $i++) {
$originalFileName = $formInputs[$i];
$fileNameWithSlashesAdded = stripslashes($originalFileName);
$fileNameWithSlashesAdded = addslashes($fileNameWithSlashesAdded);

$filePath = "../site_specific_files/".$fileNameWithSlashesAdded;

if (! @ file_exists($filePath)) {
$controller->addToResults("We were not able to import '$filePath'.
Usually this means the software stumbled over an unusual character in
the file name.");
return false;
}
// Analyze file and store returned data in $ThisFileInfo
$ThisFileInfo = $getID3->analyze($filePath);


This works fine, except when there is a quote mark in the file name.
I've tried using addslashes, and I've tried not using addslashes, and
I've tried using addslashes twice.

No dice. Nothing works.

This is on a server running RedHat Linux.

Suggestions?

 >> Stay informed about: how do you open a file with quote marks in the file name o.. 
Back to top
Login to vote
lawrence k

External


Since: Jul 06, 2007
Posts: 11



(Msg. 2) Posted: Thu Oct 18, 2007 6:05 pm
Post subject: Re: how do you open a file with quote marks in the file name on Linux? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 18, 8:38 pm, lawrence k wrote:
> I've got a client that is a music studio and they've several thousand
> mp3s that tend to have file names like this:
>
> Adrian Orange - Bitches Is Lord - 13 - Don't Get Used To It.mp3
>
> The quote mark in that file name is giving me trouble.
>
> The music studio asked me to write a script that could read all the
> metadata out of their mp3s and then store the info in a database.
> Using the getID3 library, I've had an easy time with all the files
> that don't have quote marks in their names:
>
> require_once('../getid3/getid3/getid3.php');
> $getID3 = new getID3;
>
> for ($i=0; $i < count($formInputs); $i++) {
> $originalFileName = $formInputs[$i];
> $fileNameWithSlashesAdded = stripslashes($originalFileName);
> $fileNameWithSlashesAdded = addslashes($fileNameWithSlashesAdded);
>
> $filePath = "../site_specific_files/".$fileNameWithSlashesAdded;
>
> if (! @ file_exists($filePath)) {
> $controller->addToResults("We were not able to import '$filePath'.
> Usually this means the software stumbled over an unusual character in
> the file name.");
> return false;
> }
> // Analyze file and store returned data in $ThisFileInfo
> $ThisFileInfo = $getID3->analyze($filePath);
>
> This works fine, except when there is a quote mark in the file name.
> I've tried using addslashes, and I've tried not using addslashes, and
> I've tried using addslashes twice.
>
> No dice. Nothing works.
>
> This is on a server running RedHat Linux.
>
> Suggestions?


Oh, strange. Apparently I just needed stripslashes. That's all. So
weird.

 >> Stay informed about: how do you open a file with quote marks in the file name o.. 
Back to top
Login to vote
Michael Fesser

External


Since: Mar 01, 2006
Posts: 315



(Msg. 3) Posted: Fri Oct 19, 2007 3:34 am
Post subject: Re: how do you open a file with quote marks in the file name on Linux? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

..oO(lawrence k)

>On Oct 18, 8:38 pm, lawrence k wrote:
>
>> I've got a client that is a music studio and they've several thousand
>> mp3s that tend to have file names like this:
>>
>> Adrian Orange - Bitches Is Lord - 13 - Don't Get Used To It.mp3
>>
>> The quote mark in that file name is giving me trouble.
>>
>> The music studio asked me to write a script that could read all the
>> metadata out of their mp3s and then store the info in a database.
>> Using the getID3 library, I've had an easy time with all the files
>> that don't have quote marks in their names:
>> [...]
>>
>
>Oh, strange. Apparently I just needed stripslashes. That's all. So
>weird.

I don't think so. You should only need stripslashes() if magic quotes
are enabled (can be checked with get_magic_quotes_gpc()) to remove them.
No magic quotes, no stripslashes().

Micha
 >> Stay informed about: how do you open a file with quote marks in the file name o.. 
Back to top
Login to vote
lawrence k

External


Since: Jul 06, 2007
Posts: 11



(Msg. 4) Posted: Fri Oct 19, 2007 11:47 am
Post subject: Re: how do you open a file with quote marks in the file name on Linux? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Oct 18, 9:34 pm, Michael Fesser wrote:
> .oO(lawrence k)
>
>
>
> >On Oct 18, 8:38 pm, lawrence k wrote:
>
> >> I've got a client that is a music studio and they've several thousand
> >> mp3s that tend to have file names like this:
>
> >> Adrian Orange - Bitches Is Lord - 13 - Don't Get Used To It.mp3
>
> >> The quote mark in that file name is giving me trouble.
>
> >> The music studio asked me to write a script that could read all the
> >> metadata out of their mp3s and then store the info in a database.
> >> Using the getID3 library, I've had an easy time with all the files
> >> that don't have quote marks in their names:
> >> [...]
>
> >Oh, strange. Apparently I just needed stripslashes. That's all. So
> >weird.
>
> I don't think so. You should only need stripslashes() if magic quotes
> are enabled (can be checked with get_magic_quotes_gpc()) to remove them.
> No magic quotes, no stripslashes().


I guess magic quotes were enabled. It's an old installation, from 3 or
4 years ago, so the server probably adheres to a lot of old practices.
Or maybe it has whatever defaults RedHat Linux shipped with 3 years
ago.

But I did hit the file name with stripslashes, and suddenly the code
worked.
 >> Stay informed about: how do you open a file with quote marks in the file name o.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
PHP & Quote Marks - Hi All, I cannot get this stupid Javascript code to embed properly in my PHP. It does not show the 'select' button. I believe it is my quotes, maybe Javascript does not like something....... Anyhow, can someone help me with the syntax?? I'd really..

Open word file using php in linux server - I have to open word document in web page using php coding in linux server.. already i worte in windows supporting php code. but it is not working in my linux server so, i need how to open word document in linux server without COM class.

want to get content of one php file in another php file - i have one php file having content Contents of ex1.php file <body> <?php $content = "c://webserver/www/abc.php"; $handle = fopen($content, "r"); echo fread($handle,filesize($content)); ?> </body> this is reading abc...

getting the name of the PHP file - Hi! I am a PHP beginner, and I don't know my way around. Let's say I have a file named as "file.php". Is there a special variable that already includes the file name, or should I just manually code it into the script; i.e. $filename = "...

File selection? - I'm running some php scripts locally (Windoze XP) to operate on local files and, at least partly because I can't seem to access the parameters via argv[] or get it to print out in my DOS box, it seems sensible to run it via a web page (I'm running..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]