RE: getting a file name

Brian Raven <[email protected]> Mon, 20 Feb 2012 10:00:38 +0000
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <F4203BE2BBEC5F4AB88CE7503B82EAB00585926FB9@pcacoexm01.europe.nyx.com>
From: [email protected] [mailto:[email protected]] On Behalf Of John DePasquale
Sent: 20 February 2012 07:05
To: [email protected]
Subject: getting a file name

> Hi all,
> I am unable to get a full file name ( including path ) from a form. I'm using  <input id="filename"
> type="file" name="filename"> in the form.
>
> In the perl code I've tried using both of the following:
>
> 1:
> my $cFile  = substr( CGI::param( 'filename' ), 0, 100 );
>
> 2:
> my $cgi = new CGI();
> my $cFile = $cgi->param('filename');
>
> the html presents me with a "browse" button, and when I select a file via the browse I end up with the string > c:\images\file.jpg in the input box.
> However, I only get file.jpg assigned to the variable $cFile. I am unable to acquire the entire value ( i.e.
> c:\images\file.jpg ), even though that entire string is appearing in the input box after the file is selected > via the browse button. I'm guessing I'm missing something simple and I've tried to track down an answer, but
> I'm stuck. Any help is appreciated. Thank you.

I don't think that this is a Perl problem. Your script is simply reporting the data as it was presented by the browser. As I understand it, that type of input field is normally used for uploading files, so only the file name is needed, not the full path. There may be a good reason for your browser to behave that way, such as security.

You may stand a better chance of getting help in a forum that specialises in browser/html/cgi issues.

HTH


--
Brian Raven



Please consider the environment before printing this e-mail.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy.

Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs