954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Uploading files using HTTP/X and CGI

Hi,

I am uploading files to a server using

HttpXCtl1.Request.PrepareFileUpload "nameoffile", txtURL
HttpXCtl1.Post "http://www.myhost.com/cgi-bin/serverside.cgi"
MsgBox HttpXCtl1.Response.Status

The Response Status is: HTTP/1.1 500 Internal Server Error


The serverside.cgi file on my server is as follows:

#!/usr/bin/perl -w

use CGI;

$upload_dir = "/usr/home/myhost/www/ibp";

$query = new CGI;

$filename = $query->param("nameoffile");

$filename =~ s/.*[\/\\](.*)/$1/;

$upload_filehandle = $query->upload("nameoffile");

open UPLOADFILE, ">$upload_dir/$filename";

binmode UPLOADFILE;

while ( <$upload_filehandle> )

{

print UPLOADFILE;

}

close UPLOADFILE;


This file on the server works correctly when a file is uploaded using a form post as follows:

However when the post is made using HTTP/X the error is encountered. Is the CGI script to read the HTTP/X post correct in this case? If not could you please provide a sample of the CGI script to accomplish this?


Thanks

Best Regards

Mohit Singh

Mohit Singh
Newbie Poster
1 post since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You