upload file to a non IIS site using asp.net

B

Brian

Hi, I've been trying to find a way to upload file to another site that
is not using IIS. The site that I want to upload file to has a simple
php script to receive file uploaded through standard http post with a
file upload. However, how do I upload file to the site using asp.net?


thanks
Brian
 
J

Joerg Jooss

Brian said:
Hi, I've been trying to find a way to upload file to another site that
is not using IIS. The site that I want to upload file to has a simple
php script to receive file uploaded through standard http post with a
file upload. However, how do I upload file to the site using asp.net?

Do you want to include a file upload option in a web form or do you
want to upload the file in your server-side code?

Cheers,
 
B

brianinbox

I need both. In the Web form user can upload a file to another Apache
server that has a php script to received the uploaded file or they can
upload the file to my site and my IIS server will do some server side
process and then upload the processed file to an Apache server.

thanks
Brian
 
K

Ken Cox [Microsoft MVP]

Hi Brian,

You might want to investigate the Webclient class for that. It allows you to
simulate - in code - all the aspects of a POST, including uploading a file:

http://msdn.microsoft.com/library/d...lrfsystemnetwebclientclassuploadfiletopic.asp

' Create a new WebClient instance.
Dim myWebClient As New WebClient()
Console.WriteLine(ControlChars.Cr + "Please enter the fully qualified path
of the file to be uploaded to the URL")

Dim fileName As String = Console.ReadLine()
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString)

' Upload the file to the Url using the HTTP 1.0 POST.
Dim responseArray As Byte() = myWebClient.UploadFile(uriString, "POST",
fileName)

Ken
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top