WebClient class transfer file problem

  • Thread starter Thread starter Federico Bari
  • Start date Start date
F

Federico Bari

I have the necessity to send an xml file to a CGI application using the
https protocol (then the CGI application have to store the datas of the xml
file in a mySQL database). I saw the useful WebClient class for C#, but it
isn't explained in which variable i can find the file on the server side.
Can you help me? thank you! Federico.
 
Federico,

Are you supposed to send the file as a file, or do you want to send the
contents of the file? If you want to send the contents of the file as part
of the request, then chances are you have to POST the contents, and you can
do so with one of the overrides for DownloadData.

As for uploading an actual file, you can use the UploadFile method on
the WebClient class to upload the appropriate file to the server.

Hope this helps.
 
yes i saw that i can use UploadFile ... i have the problem on the server
side, not the client. The client have to upload the file ... on the other
side i have a cgi server application that take this file and do what it has
to do. The problem: which is the name of the cgi enviroment variable who has
the file data? How can i refer to the recieved data inside the php or perl
application? Thanks, Fede.


Nicholas Paldino said:
Federico,

Are you supposed to send the file as a file, or do you want to send the
contents of the file? If you want to send the contents of the file as part
of the request, then chances are you have to POST the contents, and you can
do so with one of the overrides for DownloadData.

As for uploading an actual file, you can use the UploadFile method on
the WebClient class to upload the appropriate file to the server.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Federico Bari said:
I have the necessity to send an xml file to a CGI application using the
https protocol (then the CGI application have to store the datas of the xml
file in a mySQL database). I saw the useful WebClient class for C#, but it
isn't explained in which variable i can find the file on the server side.
Can you help me? thank you! Federico.
 
Back
Top