http://www.perlmonks.org?node_id=214237

kidd has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks:

I have a little script that lets users upload files to my server. My server is currently running in an UNIX OS.

The problem is that when a user with Windows OS has a file name or route the the file name with spaces, when uploading to the server it doesnt upload anything.

i.e.

c:/my documents/my image.jpg

Right now I had to set up a Javascript in the form that ckecks if there is any space in the file name or the route.

The thing is that I would like to be able to let them upload the files even with spaces...but I dont know how...

Hope that I can hear suggestions from you...

THANKS

Replies are listed 'Best First'.
Re: Uploading File Problems
by Ovid (Cardinal) on Nov 19, 2002 at 20:19 UTC

    Show us your Perl code (a minimal test case, if possible) and the HTML form tag. With that, we can probably provide you with a better answer.

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

Re: Uploading File Problems
by gjb (Vicar) on Nov 19, 2002 at 20:08 UTC

    It might help to change spaces to %20, ie. hex value for space.

    Hope this helps, -gjb-

      You should implement this using the module URI::Escape.

      Update: I R silly... thanks to UnderMine for pointing that out. Forget what I said.

      -nuffin
      zz zZ Z Z #!perl
        Arn't these spaces that need replacing on the client not the server?

        Hope it helps
        UnderMine

Re: Uploading File Problems
by UnderMine (Friar) on Nov 19, 2002 at 21:12 UTC
    A quick question

    Can you confirm whether the script is receiving the file but can't store it or it just does not recieve the file at all.

    If you are receiving the file but it is not possible to save it $filename=~s/\s/_/g; or even just use a $filename='lastupload.data'; to see if it is the spaces in the filename on the server that are causing the issue.

    Hope this helps
    UnderMine