Forum Moderators: coopster & phranque

Message Too Old, No Replies

getting absolute path from <input type=file> tag

         

rajatgarg

11:29 pm on Jul 20, 2004 (gmt 0)

10+ Year Member



Hi,

In my case, I am trying to access filename by using,

$query->{'filename'}, but it returns only the filename and not the absolute path. Can anybody suggest some solution ....Pls help?

I have used Mozilla, Konqueror as Browser and using Perl/CGI for above stuff (CGI.pm)

Regards,
Rajat Garg

lexipixel

10:07 am on Jul 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have you tried $ENV{'DOCUMENT_ROOT'}?

example-

$filename = 'filename.ext';
$upload_dir = 'uploads';
$docroot = $ENV{'DOCUMENT_ROOT'};
$FullFileSpec = "$docroot/$upload_dir/$filename";

If your site is on a shared server, most likely $ENV{'DOCUMENT_ROOT'} will return something like-

/c3p0/user/foobar/www

(if your domain was foobar.com and you were on a server named C3P0...)

###