•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 423,511 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,619 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 4436 | Replies: 0
![]() |
•
•
Join Date: Jul 2004
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Uploading files Access Denied Error (ASP.NET)
- Problem in Uploading Files using Register Global on/off (PHP)
- HTML form action="env.cgi" question (HTML and CSS)
- CGI with C++. my cgi script in perl works perfectly but not c++ (C++)
- can't change homepage from http://db105.com:81/cgi-bin/index.cgi?c=0 (Viruses, Spyware and other Nasties)
- help - need coding for file attachment to a cgi file (Windows NT / 2000 / XP / 2003)
Other Threads in the Shell Scripting Forum
- Previous Thread: Bash shell screipt help
- Next Thread: requesting for help doing this program


Linear Mode