FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Spaces in filenames
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Spaces in filenames [message #173706 is a reply to message #173701] Sat, 30 April 2011 12:49 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 4/29/2011 7:00 PM, Tim Streater wrote:
> When my app starts up, it discovers where it has been installed using:
>
> $instdir = dirname (__FILE__);
>
> Now, I have no control over where this might be in the file system, and
> the user may well put it somewhere such that the path contains spaces.
> I'm passing this round the app, and in the fullness of time may be doing
> things like:
>
> $fp = fopen ($instdir . "/wiggy", "r");
>
> Does it matter to PHP filesystem functions if the filename contains spaces?
>
> But what's worse, I'll also be passing $instdir to shell scripts via
> exec ().
>
> Seems to me I can:
>
> 1) search/replace $instdir to escape spaces with backslash-space. But
> does this mess up PHP filesystem functions?
>
> 2) leave $instdir as-is, but use escapeshellarg on it whenever I need to
> pass it through exec().
>
> Which is the better approach?
>

Why don't you just try it?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP Runs In WinXP Command Window But Not In Browser
Next Topic: Html code beautifier
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 21:26:05 GMT 2024

Total time taken to generate the page: 0.04611 seconds