Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I'm Developing web application in ASP.NET MVC 5, One of the web from wants to show an images on it. That web form should work as like dropbox (If i put a image into my PC folder, it may automatically synthesize with my website). i'm just getting lack to do this type of thing. Any one please give an ideas.
Posted

1 solution

What you need is something else. It is not an ordinary client for your website, instead it is a full featured application software that manages your file system and at the same time keeps a note of your documents and files on the server.

Dropbox application creates a folder on your file system to manage. All of the files in it are watched by a watchdog. In real, (or in .NET) you can use a FileSystemWatcher[^] object to determine when a change occurs in that directory. I recommend that you read the remarks about the class.

Your application needs this object in order to keep a track of what happens to that directory or the files in it. Then you can perform different actions. For example if a new file is added to the folder, you can pass that file to your website (or cloud?). HttpClient[^] would be a very perfect candidate (IMHO).

C#
using (var client = new HttpClient()) {
   // get the location of that file
   // POST a multipart/form-data content
}


A sample for that can be found in this thread: http://stackoverflow.com/questions/18059588/httpclient-multipart-form-post-in-c-sharp[^]

Then finally, you need to handle the request and capture the content and upload it. A long one, but... I am sure if you simply put the algorithm on paper first and then write the source code step-by-step you will be able to get it done.
 
Share this answer
 
Comments
Member 11892597 11-Aug-15 2:06am    
Thank you Afzaal Ahmad Zeeshan, i hop this is good solution for my problem
Afzaal Ahmad Zeeshan 11-Aug-15 4:13am    
You can also mark this as answer by clicking that green button.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900