can you please tell me how to do that. i am using CGI/Perl
Main Topics
Browse All Topicsin my cgi script, i have small part of html code, <input type = file> where user specifies file name
1) how can i upload user's .doc file and copy it on my server.
2) finally can i copy the same file on client machine
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
i tried
#!c:/perl/bin/Perl.exe
use CGI;
print "Content-type: text/html; charset=iso-8859-1\n\n";
$|=1;
my $q = new CGI;
my $bytesread = 0;
my $buffer = '';
$file = $q->param('upload_file');
print "$file";
open( FID, "> $file" ) or die "cannot open file";
while (my $more=read( $file, $buffer, 8192 ))
{
$bytesread+=$more;
print FID $buffer;
}
it creates file c:\\test.doc on server but it is not copying the contents of test.doc form clients machine to server.
the file is empty on server may be because its not going in whike loop
i tried this
#!c:/perl/bin/Perl.exe
use CGI;
print "Content-type: text/html; charset=iso-8859-1\n\n";
$|=1;
my $q = new CGI;
my $bytesread = 0;
my $buffer = '';
$file = "c:\\test.doc";
print "$file";
open( FID, "> $file" ) or die "cannot open file";
while (my $more=read( $file, $buffer, 8192 ))
{
$bytesread+=$more;
print FID $buffer;
}
still it is not reeading the file c:\test.doc from client....
Business Accounts
Answer for Membership
by: ahoffmannPosted on 2006-04-21 at 17:37:09ID: 16512818
1) you need a cgi which reads the uploaded data and saves it to a file
2) I guess you can, but this has nothing to do with web servers, CGI or internet at all