Nate wrote at Sun, 28 Jul 2002 09:51:06 +0200: > i'm writing a website that requires an upload for pictures. I have figured out how >to get the > image, upload it to the correct dirctory and save successfully, but the problem >comes with the > fact that i have to specify the filename. i want to know how to grab the filename >from the input > of the following script (and by the way, i do not take credit for this script. i've >only been > programming in perl for about a day) > > #!c:/perl/bin/perl.exe
use CGI; # otherwise, you can't use $CGI::POST_MAX > $CGI::POST_MAX = 2048; Little pics ? > print "content-type: text/html\n\n"; ^ Content-type or better print header(); # using CGI module > binmode(STDIN); > @inx = <STDIN>; > splice(@inx,0,4); > splice(@inx,$#inx,1); > $in = join("",@inx); > $in = substr($in,0,length($in) - 2);; > open(ff,">../htdocs/pics/z.jpg"); > binmode(ff); > print ff $in; > close(ff); > print "DONE, Uploaded Size: ".length($in)." bytes"; > > obviously in the open(ff, ">../htdocs/pics/z.jpg"); i don't want it to save the >picture as "z.jpg" > i want it to be saved under it's original filename. So how do i draw out the >filename minus the > directory settings (i.e. c:/my documents)? > Take a look to the File::Basename module from CPAN. Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]