Download file from webservice - in ASP.NET site

后端 未结 4 2428
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 14:00

I want to push a file to the browser from a website using a webservice. I\'m currently reading the file into a base64 byte array, and returning that from the webservice. This w

4条回答
  •  既然无缘
    2021-02-20 14:10

    Its usually a bad idea to embed a file in a web service. You just add overhead and complexity with no real benefit.

    Instead you should provide a IHttpHandler to handle the file upload. Most web servers also provide helper API's to simplify this, e.g. in ASP.NET you can access the uploaded file with:

    HttpContext.Request.Files[0]

    There are plenty of javascript file upload scripts that simplify this on the client: http://www.phpletter.com/Demo/AjaxFileUpload-Demo/

提交回复
热议问题