473,422 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,422 software developers and data experts.

vb.net cgi uploading files

Hi all,

I'm trying to do what I consider to be a fairly simple task, yet I'm
having a heck of a time getting it to work. I'm trying to upload a
file (without user intervention and a browser) from a vb.net client
(using webclient or httpwebrequest) to a webserver running a cgi script
to store it on the webserver.

I'm not familiar with perl/cgi very well and am really struggling with
it. I kind of got it to partially work with webclient object and using
uploadvalues by sending the data in namedata collection. However, I
was only able to send half the file (according to the messagebox)
before I started getting 408 request timeout errors. (I determined
this by just sending half the file in the string instead of the whole
file contents).

Any help at all would be great. here are some snippets of my basic
flow. It may not be exact, but you can get the feel.

in VB.net:

Dim myQueryStringCollection As New NameValueCollection

myQueryStringCollection.Add("file", "C:\LogFile")
myQueryStringCollection.Add("data", dataContents) - a string
containing the log file contents

myWebClient = New WebClient
myWebClient.Credentials = New NetworkCredential("", "")
httpresponsearray = myWebClient.UploadValues(txtDest.Text, "POST",
myQueryStringCollection)
MsgBox(Encoding.ASCII.GetString(httpresponsearray) ) 'show
results
in CGI: (very simple just to see if the script is receiving)

#!/usr/bin/perl -w

use CGI;

print "Content-type: text/html\n\n";
print "<html><body>";

$query = new CGI;

$filepath = $query->param ('file');
$dest = $query->param ('data');

$destfile = "C:\\uploads\test.txt";
print $dest, "<br>";
print "Your file ($destfile) has been successfully uploaded.","<br>";
print "</body></html>";

Any ideas what is wrong, are there better ways to do this ? If someone
has already done this and has some code they would share, that would be
SOOOOO great.

Mark

Nov 23 '05 #1
4 3858
You can find that how to implement uploading files in RFC-1867 and does not
using the CGI Module!

<ma*****@yahoo.com> ???
news:11*********************@g14g2000cwa.googlegro ups.com ???...
Hi all,

I'm trying to do what I consider to be a fairly simple task, yet I'm
having a heck of a time getting it to work. I'm trying to upload a
file (without user intervention and a browser) from a vb.net client
(using webclient or httpwebrequest) to a webserver running a cgi script
to store it on the webserver.

I'm not familiar with perl/cgi very well and am really struggling with
it. I kind of got it to partially work with webclient object and using
uploadvalues by sending the data in namedata collection. However, I
was only able to send half the file (according to the messagebox)
before I started getting 408 request timeout errors. (I determined
this by just sending half the file in the string instead of the whole
file contents).

Any help at all would be great. here are some snippets of my basic
flow. It may not be exact, but you can get the feel.

in VB.net:

Dim myQueryStringCollection As New NameValueCollection

myQueryStringCollection.Add("file", "C:\LogFile")
myQueryStringCollection.Add("data", dataContents) - a string
containing the log file contents

myWebClient = New WebClient
myWebClient.Credentials = New NetworkCredential("", "")
httpresponsearray = myWebClient.UploadValues(txtDest.Text, "POST",
myQueryStringCollection)
MsgBox(Encoding.ASCII.GetString(httpresponsearray) ) 'show
results
in CGI: (very simple just to see if the script is receiving)

#!/usr/bin/perl -w

use CGI;

print "Content-type: text/html\n\n";
print "<html><body>";

$query = new CGI;

$filepath = $query->param ('file');
$dest = $query->param ('data');

$destfile = "C:\\uploads\test.txt";
print $dest, "<br>";
print "Your file ($destfile) has been successfully uploaded.","<br>";
print "</body></html>";

Any ideas what is wrong, are there better ways to do this ? If someone
has already done this and has some code they would share, that would be
SOOOOO great.

Mark

Nov 23 '05 #2
I don't want something form based though because this will be executing
behind the scenes in the background of the app.

Nov 23 '05 #3
I don't want something form based though because this will be executing
behind the scenes in the background of the app.

Nov 23 '05 #4
ma*****@yahoo.com wrote in news:1131466692.289424.79440
@g14g2000cwa.googlegroups.com:
I'm not familiar with perl/cgi very well and am really struggling with
There is no such monster called perl/cgi. There is the Perl language and
the CGI protocol. Failing to partition the problem leads to wasted time.
#!/usr/bin/perl -w

use CGI;

print "Content-type: text/html\n\n";
print "<html><body>";

$query = new CGI;

$filepath = $query->param ('file');
$dest = $query->param ('data');

$destfile = "C:\\uploads\test.txt";
print $dest, "<br>";
print "Your file ($destfile) has been successfully uploaded.","<br>";
print "</body></html>";

Any ideas what is wrong, are there better ways to do this ? If someone
has already done this and has some code they would share, that would be
SOOOOO great.


Yes, someone has already done it. The correct ways to submit the upload, as
well as to process it are explained in the CGI.pm documentation.

Sinan
Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dickiedyce | last post by:
Hi there. I've spent the weekend getting ever more frustrated, trying to get an upload file function working on a website. The site is hosted by a company called oneandone. They're using PHP...
5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
0
by: Raj | last post by:
Hello, I am planning to provide the Pause/Resume while uploading files. Our site is using both java applet and activex to do this. The list of selected files will be stored in an encrypted...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
2
by: =?ISO-8859-1?Q?=22=C1lvaro_G=2E_Vicario=22?= | last post by:
jodleren escribió: I haven't found the PHP manual page where such feature is documented but a few tests have shown that this behaviour changes depending on the charset parameter of the...
1
by: =?Utf-8?B?RGFu?= | last post by:
MS won't seem to let me reply to my old post, so I created a new one. The error occurs in all browsers. It's definitely a server issue, not client. The server is not proxied in any way. I tried...
3
by: muziburrehaman | last post by:
i am looking for code in php to upload the 1 gb files. any one can please help me by sending the code....
0
by: LoriFranklin | last post by:
I'm a bit of a newbie here. I've learned a lot from reading the posts you all have here. I need some help uploading files using an asp form. I am using some code that I found from Jacob at...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.