Link to home
Start Free TrialLog in
Avatar of perlperl
perlperl

asked on

file

file upload...i m trying to upload client's file on server


#!c:/perl/bin/Perl.exe
use CGI;

print "Content-type: text/html; charset=iso-8859-1\n\n";
$|=1;

print "Upload File.........\n";
$query = new CGI;
$filename = $query->param("upload_file");
print "$filename  : <br>";
$filename =~ s/.*[\/\\](.*)/$1/;
$upload_filehandle = $query->upload("upload_file");
$upload_dir = "C:\\file.txt";

open UPLOADFILE, ">$upload_dir";
#binmode UPLOADFILE;
 while ( <$upload_filehandle> )
 {
   print UPLOADFILE;
 }
 close UPLOADFILE;


it does create the file c:\file.txt on server, but the file is empty, when menas the script is not able to read clients file...
Any ideas, why?
is it due to some apache configuration?
Avatar of perlperl
perlperl

ASKER

i guess i have to change the header
print "Content-type: text/html; charset=iso-8859-1\n\n";  to read the clients file (just guessing....)
because right now its not even going in the while loop
ASKER CERTIFIED SOLUTION
Avatar of Kim Ryan
Kim Ryan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
but where exactly are you redirecting the page...i mean theris nothing like "action = blah...cgi"
i got it
print $query->start_multipart_form(-action=>"hkshfk.cgi"),

but how do i create the fancy html like tables....initially my form elements were in tables