>From how I understood it file::basename was able to tell figure out the
filename without path for both windows and UNIX.
I have an html page that has a form field for uploading a file. When I
hit the choose button it lets me pick something from my directory. Now
the filename it returns is the full path surrounded in quotes.

I have done this with and without the quotes and both the result is
always the same.

I am working on an apache server running on Linux. I am using a windows
xp machine to connect to the server and I am using opera as the browser.

Here is the code..
#!/usr/bin/perl -T

use strict;
use warnings;
use CGI;
use File::Basename;

my $cgi = new CGI;
print $cgi->header( "text/plain" );

foreach my $name ( $cgi -> param ) {
  print "$name:";
  foreach my $value ( $cgi -> param ( $name ) ) {
    print " $value\n";
  }
}


#upload file
my $file = $cgi -> param ( 'file' );
my $basename = basename $file;
print "$file\n";
print "$basename\n";

#my $fh = $cgi -> upload ( $file );


Here is the output
------
fname: p
lname: k
file: "C:\Documents and Settings\pdk\My Documents\My
Webs\pelsupply\index.htm"
"C:\Documents and Settings\pdk\My Documents\My Webs\pelsupply\index.htm"
"C:\Documents and Settings\pdk\My Documents\My Webs\pelsupply\index.htm"

Any suggestions?

Paul Kraus


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to