in reply to Too late to substitute param()

What is the type of the form field you're naming file? Is it FILE (<input type="file" name="file">)? If so the problem is that in an HTML form file upload you can not count on getting a complete filename. Some browsers send only the filename, others include the path. Relying on the soure-path of the uploaded file in your CGI is a bad idea. HTML form file uploads are designed for uploading the contents of the file and not its name/location.

To quote from the CGI module's docs:

Different browsers will return slightly different things for the name. Some browsers return the filename only. Others return the full path to the file, using the path conventions of the user's machine.

You may want to see the earlier perlmonks discussion entitled grabbing text which covers the same topic.

Replies are listed 'Best First'.
RE: Re: Too late to substitute param()
by NeverMore (Acolyte) on Jun 02, 2000 at 07:22 UTC
    Yes, this is the problem, but I'm not quite sure I understand how to fix the problem. Could you show me the code I should use?

    -NM

      This problem is non-fixable (unless you want to convince all the browser manufacturers to change their products or can get all your users to use only browsers that do pass the path). The problem is that the data you are interested (path name) isn't passed by some browsers. There is nothing you can do server-side that would induce the browser to send the path information. The data you want (path to the file being uploaded) simply isn't being passed and there is nothing you can do about it. I'm sorry but there is nothing you can do to fix this problem.