Gossamer Forum
Home : Products : Gossamer Links : Discussions :

$IN->param not returning full path

Quote Reply
$IN->param not returning full path
I am wondering why I cannot get $IN->param to return the full path.

<form method="POST" enctype="multipart/form-data" blah blah
blah
<input type="file" name="file">
submit blah
</form>

and in the cgi which the form calls:

my $thefile = $IN->param('file');
print "File: $thefile<br>";

This prints the name of the file, but not the full path to the file.

Any ideas?
Quote Reply
Re: [Ian] $IN->param not returning full path In reply to
Strange, that should be doing what you expected.

Can you show the exact html you are using?
Quote Reply
Re: [Paul] $IN->param not returning full path In reply to
Hey Paul,

I think it may be because the form input field is passing the whole file and not the path to the file.

How would I get it to pass the path and not the contents???
Quote Reply
Re: [Ian] $IN->param not returning full path In reply to
Actually, I'll just pass the whole file and read its contents, it will be simpler.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Ian] $IN->param not returning full path In reply to
It should pass the path by default then in your script you read the file contents with:

Code:
my $buffer;
my $file = $IN->param('file');
$buffer .= $_ while (<$file>);
Quote Reply
Re: [Paul] $IN->param not returning full path In reply to
That works! Merci!Cool
Quote Reply
Re: [Ian] $IN->param not returning full path In reply to
If you want the file name you can probably do something like:

Code:
my ($name) = $file =~ m|([^\\/]+)$|;