LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2007, 11:01 AM   #1
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Rep: Reputation: 32
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.
 
Old 06-11-2007, 10:42 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl cgi Script can`t make file.Why? ZairSadiqov Linux - Software 1 11-22-2006 07:22 AM
full path of a file ttilt Linux - General 1 11-08-2005 06:02 PM
get full path of uploaded file in php spoody_goon Programming 2 05-10-2005 07:32 PM
How to parse full path of file name in bash ? hq4ever Programming 2 03-28-2005 03:31 PM
cgi perl : I cant get perl to append my html file... the_y_man Programming 3 03-22-2004 05:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration