upload a txt file on a remote web server

S

shantanu

Hi
i am trying to upload a txt file thru this code, but its not
updating
the data. is this code fine.
Or can anybody please suggest me some other meathod to do the same.
its urgent please help

regards
shantanu


WebClient client = new WebClient();
client.Credentials = netCred;
client.Headers.Add("Content-Type","application/x-www-form-
urlencoded");
client.UploadFile("http://aww.ngn.bel.alcatel.be/prp/cgi-bin/secure/
ImportForm.cgi","POST",@"C:\PRP\PRPTemp.txt");
 
S

shantanu

Hello,

Checkout this link, it explains how to make it step by step

http://www.4guysfromrolla.com/webtech/091201-1.shtml

you can check as well:

http://www.c-sharpcorner.com/UploadFile/mahesh/FileUpload100920051721...

HTH
Braulio

/// ------------------------------
/// Braulio Díez
///
///http://www.tipsdotnet.com
/// ------------------------------





- Show quoted text -

hi thanx for the reply
i just read the two links where the gui is present to upload the
files. But in my case i have a excel addin that will pick few values
from the excel sheet and form a text file that is compatible to the
upload format. Now i have a link of a web page that contains a file
control and a import button. on the click of the import button it
takes the file path as the parameter and invokes import.cgi script.
Now i have to upload a file thru this link using meathod like
webclient or any other meathod.
So i hope i have explained the things . Kindly get some solution
regards
shantanu
 
G

Guest

Mmm...

Correct me if I'm wrong, but the problem that you are facing is simulating
a manual file upload: a web app has an upload button and you want to simulate
that operation, is that assumption correct?

I'm not sure if it would be a good approach to take an sniffer and see
what http traces does the manual import generate, then you could simulate
that behaviour using HTTPRequests.

Not an easy scenario, the website could have even some upload component or
strange stuff :-(, here you have a code sample about file upload using
HTTPRequests:

http://www.example-code.com/csharp/httpUpload.asp

Good Luck
Braulio


/// ------------------------------
/// Braulio Díez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
S

shantanu

Mmm...

Correct me if I'm wrong, but the problem that you are facing is simulating
a manual file upload: a web app has an upload button and you want to simulate
that operation, is that assumption correct?

I'm not sure if it would be a good approach to take an sniffer and see
what http traces does the manual import generate, then you could simulate
that behaviour using HTTPRequests.

Not an easy scenario, the website could have even some upload component or
strange stuff :-(, here you have a code sample about file upload using
HTTPRequests:

http://www.example-code.com/csharp/httpUpload.asp

Good Luck
Braulio

/// ------------------------------
/// Braulio Díez
///
///http://www.tipsdotnet.com
/// ------------------------------






- Show quoted text

Hi Thanx for the reply
i am trying this meathod today hope come up with a positive result
regards
shantanu
 
S

shantanu

Hi Thanx for the reply
i am trying this meathod today hope come up with a positive result
regardsshantanu- Hide quoted text -

- Show quoted text -

Hi
It did not work tooo
kindly assist
regards
shantanu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top