Approach for file Uploads to service from Web Server
I have to create service that can get files from any authorized source and save them on file server. Then return back response with url for t开发者_StackOverflow中文版hat resource.
The issue is that the service could be accessible from any web site or app. In case of Web site, what would be the best way to get file from a user and stream it to the service? Or do i have to save it to the web server first and then replay the stream to the service? I am thinking of creating Httphandler to channel traffic from web server (the instant file upload request is initiated by user) to the service. Would that be the best approach, or what would?
I have just implemented file transfer service for our internal use. It was a trivial service to implement that with WCF RESTFul way. What you need to do is to implement streaming over Http.
Actually, I have chosen new WCF Web Api to achieve this feature.
But if you are familiar with that, here you can see a good example on how you can implement this :
http://blogs.msdn.com/b/gblock/archive/2010/11/24/streaming-over-http-with-wcf.aspx
精彩评论