#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Norway
    Posts
    57
    Rep Power
    13

    Question PHP & FTP - whitespaces in filename = ERROR...why?


    When I try to upload a file with my php/ftp-script, and the filename contains whitespaces the upload fails....


    Any sugguestions for a solution to that?


    Freddy...
  2. #2
  3. Here, not there
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    312
    Rep Power
    13
    • Replace white spaces with underscores('_')
    • Capitalize the first letter of each word

    Don't use white spaces in file names, it simplifies life.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2002
    Posts
    693
    Rep Power
    26
    Have you tried putting the name of the file in quotes?
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Norway
    Posts
    57
    Rep Power
    13
    Ok....but the file with whitespaces is on a remote computer and I can`t access that file and rename it. I`ve tried to rename the string that contains the remote filename to a string with "_" instead of whitespaces. Then I put that string into the ftp_put()-function..........but with no luck....


    Any suggestions?`



    Freddy....
  8. #5
  9. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    Is the remote a *nix type?
    Try putting a slash '\' before the space, since spaces in unix filename cause bad things.

    There is actually a rename command in ftp, as long as you have sufficient rights to do that.

IMN logo majestic logo threadwatch logo seochat tools logo