LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   perl CGI full path to file for upload (https://www.linuxquestions.org/questions/programming-9/perl-cgi-full-path-to-file-for-upload-560913/)

GATTACA 06-11-2007 11:01 AM

perl CGI full path to file for upload
 
Hello.

I've written a cgi script to read in a user's filename for upload.

Here is the scripts body:
Code:

#!/usr/bin/perl -w
use CGI;
my $q = new CGI;

print "Content-type: text/html\n\n";

my $file = $q->param('dbFileName');


if($file) {
        print "<p>You want to upload:<b>$file</b>";
}

The problem is that the script outputs just the file name and strips the absolute path the the file. I need the full path to the file.

Is there anyway to get the full path the file?

Thanks.

theNbomr 06-11-2007 10:42 PM

If I understand you correctly, the client (browser) has specified a full path as the filespec for the upload, but the server CGI only see the filename. I think this should be considered correct behavior. No client should have the ability to write to arbitrary locations in the filesystem.
--- rod.


All times are GMT -5. The time now is 08:47 AM.