I have a service for uploading files which works well.
Is it possible to submit a file upload to a asp.net method (like normal uploads), but then forward the upload file details to the remote service. Therefore using t开发者_如何学编程he asp.net method as a proxy and NOT actual upload method?
The actual file saving will be done at the remote service.
Note I'm using c# and .net 3.5
Regards
If you are using an ASP.NET method, the file MUST be uploaded to the server. However, it doesn't have to be saved using the "SaveAs" method or any other method. You can access the file directly as a stream which you can pass to your other service if you can send streams to it.
The idea is explained in this blog post (slightly different use but same idea):
http://weblogs.asp.net/meligy/archive/2008/02/18/unit-test-friendly-file-upload-handling-in-n-tier-applications.aspx
So, if your remote service call can be simplified as a method like:
public void MyServiceMethod(Stream inputStream) { ........ }
You can pass the file content from the page without saving it some way like:
myService.MyServiceMethod(myFileUploadControl.PostedFile.InputStream);
精彩评论