943,522 Members | Top Members by Rank

Ad:
Jul 19th, 2004
0

Uploading files using HTTP/X and CGI

Expand Post »
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:

<form method="POST" enctype="multipart/form-data" action="/cgi-bin/serverside.cgi">

<p> <input type="file" name="nameoffile" size="20"></p>

<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>

</form>



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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Mohit Singh is offline Offline
1 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Bash shell screipt help
Next Thread in Shell Scripting Forum Timeline: requesting for help doing this program





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC