How to get a file from a Database and put it in an FTP?
I have an aspx page that gets a list of documents available in a database through a DataGridview and I want that when the users clicks on the link of the document he开发者_如何学Go want's to sent it as an FTP or HTTP document, like if it was on a drive on the server.
The problema I have is that I know that when the file is on a drive it is easy but if it is on the database I do not know how to serve it to the web page user.
I thougth maybe that when de user clicks on the link to save the file to a temp directory, and then redirect the page to that page with the name of the file, but I do not know if it is to much of a touble and there is a better way. Of course if I do this I will have to delete the file from the drive after it has been downloaded.
I get the way to do this, is just a matter of use
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition", "attachment; filename=SailBig.jpg");
//Response.BinaryWrite(foto);
Response.OutputStream.Write(foto, 0, foto.Length);
The file, is in binary.
精彩评论