curl-users
Beginner's help with Perl and Curl
Date: Thu, 26 Apr 2007 08:43:44 -0400
Hello,
I am trying upload a file via Curl from a Mac to a Linux server. The Linux
server has a Perl script to try and receive the file (note the "try") but
there is no actual form on this website. The Curl command I am using is:
curl -L -F "fileName=@/root/install.log"
http://xxx.xxx.com/profiles/index.pl
The server name has been changed to protect the innocent but the gist of
what I am trying is there. The file will change when I get the process
stabilized.
The receiving end is using a (what I thought would be) simple Perl script
to
receive this file to a tmp area before being archived. I have included the
script below for review. I am at a complete loss as I recieve Internal
Server 500 errors that are cryptic in the log. Any help is greatly
appreciated.
Perl Script:
[code]
#!/usr/bin/perl -w
use CGI;
my $upload_dir = "/tmp/profiles";
# Permissions on the /tmp/profiles are 777
my $query = new CGI;
my $filename = $query->param("fileName");
$filename =~ s/.*[\/\\](.*)/$1/;
my $upload_filehandle = $query->upload("fileName");
open UPLOADFILE, ">$upload_dir/$filename";
# binmode UPLOADFILE;
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
#print "File transfer complete!\n";
[/code]
Thanks for taking the time to review.
Scott Medaugh
Received on 2007-04-26