Results 1 to 2 of 2
  1. #1

    Question php scripts cant locate filenames with spaces

    Hi and good morning guys,

    I have a fresh dedicated server that im currently configuring and needed a little help if I may ask.

    The problem is that i'm having a file naming issue.

    for example from the web I can access any file that does not have spaces of any type.
    this works fine and my php script can locate it

    But the problem is when I try to access a file that has spaces.
    /music/The Eagles - Hotel California.mp3

    my php script can't seem to locate any files like this with spaces but doesn't have a problem locating the files with no spaces.

    I also took a look at the directory within shell. I did notice that files that have spaces are showing up in this formatt in shell.

    #/home/~username/public_html/music/The\ Eagles\ -\ Hotel\ California.mp3

    In shell , i'm assuming that unix/linux maybe adds a backslash before spaces. But when I FTP to this same directoy, the filename look normal and at windows standard.

    how could I correctly access these types of files within my php scrits? or would I need to have all uploaded files renamed so that spaces are replaced with underscores maybe??

    any help would be greatly appreciated!


  2. #2
    Join Date
    Jan 2006
    Athens, Greece
    If the script searches the local file system first then maybe you need to escape the name string so to be exactly like your OS displays it...

Similar Threads

  1. PHP with spaces or without spaces
    By flam316 in forum Programming Discussion
    Replies: 12
    Last Post: 04-04-2011, 03:34 PM
  2. apache/php locate infnite loop
    By ytz991 in forum Hosting Security and Technology
    Replies: 3
    Last Post: 12-03-2008, 12:43 PM
  3. validate usernames and/or filenames in PHP
    By ccole in forum Programming Discussion
    Replies: 8
    Last Post: 06-14-2005, 10:50 AM
  4. php help, removing spaces
    By matt2kjones in forum Programming Discussion
    Replies: 15
    Last Post: 09-29-2003, 02:07 AM
  5. Scripts/filenames often used for spam
    By nogi in forum Hosting Security and Technology
    Replies: 1
    Last Post: 02-24-2003, 08:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts