Solved

Uploading an image file from through Windows Application from local to remote destination

Posted on 2012-04-12
2
253 Views
Last Modified: 2012-05-06
Hi

I have a Windows Application, and in one of its forms there is a text filed (MyImage) that contains the path for an image file. Check attachment.

What's the code (upon clicking on the [Add] button shown in the attachment) to upload this local file into a remote server?

Note That: The remove server is on the same domain as my local machine wher I'm trying to upload the image file from, and the destination folder that I want to upload to is authenticated for "write access"  with my Active-Directory login name and password credintials only).

I want a code that doesn't use FTP, I want a one that is the same as that upload code from a web browser to a remote web server, but in my case here it's a Windows Application.
Img.png
0
Comment
Question by:alfardan
2 Comments
 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 250 total points
ID: 37836427
Here is a sample for you:-

// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

// Upload the file to the URI.
// The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method.
byte[] responseArray = myWebClient.UploadFile(uriString,fileName);

Open in new window


Read here for more detail:-
http://msdn.microsoft.com/en-us/library/36s52zhs.aspx
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 37839380
You also have this My.Computer.Network.UploadFile method

http://msdn.microsoft.com/en-us/library/dfkdh7eb(v=vs.90).aspx
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a complete list of ASP.NET page load events 3 26
SQL Login 17 38
Close tabpage of custom control 9 23
Code works but it's slow 23 30
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now