On 02/19/2012 23:04, John DePasquale wrote: > 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.
Are you doing a file upload ? If so, you don't need the path. If not, you're cheating by using the 'file' input type which was added to handle file uploads. ;) You can get around it by using a 'text' input type to pass the full path, but you would need to type it all in. But my guess is you want that browse feature. A sneaky way around it might help - make another form on the page that just does the browse part and cut-n-paste the path from that box to the text box (remember I didn't make such a stupid suggestion and I'm not even sure if the full path appears in the box). :) _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs