To reiterate, it is the entirely the clients choice which application it uses to open a file. You can prompt the client by telling it the mime-type of the file but you cannot force it to do anything. if you want it to open in paint then on the client machine
you must set paint as the default application to handle this type of file, as you are sending a jpeg i would expect the file will be handled by the browser (the common default association) I don't really understand what you are trying to achieve here. why
is it critical to your application to open jpegs in paint? can you guarantee that all your clients have paint installed? As for the other issue, when your client is a browser, the only html tag which can be used to upload a file is <input type=file, though
you could also upload files via a java applet. I believe the system.net.webclient namespace is for you to create your own bespoke client which, for example could be a desktop application or a web service..
Do not be confused by the name of the field in sql server. the field is for binary large objects and basically stores your data as is. I did exactly the same as you are talking about, the two important things are to set the content mime-type and the file extension
when streaming the file. content-Disposition", "attachment; filename=" + f.Name); Response.AddHeader("Content-Length", f.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding","binary"); Response.ContentType = "application/octet-stream"; so set
f.name as myfile.exe and I believe the mimetype for exe is "application/octet-stream". if you are initially uploading the files from a client you can capture this information and store it in the database.
Adrian Berry
Member
25 Points
5 Posts
Re: Pushing a download to the browser
Feb 13, 2004 08:10 PM|LINK
Adrian Berry
Member
25 Points
5 Posts
Re: Pushing a download to the browser
Feb 13, 2004 08:18 PM|LINK
rox.scott
Contributor
6080 Points
1214 Posts
Re: Pushing a download to the browser
May 10, 2004 05:58 PM|LINK
Ruffone
Member
567 Points
161 Posts
Re: Pushing a download to the browser
Jul 22, 2007 02:47 AM|LINK
http://www.devx.com/dotnet/Article/22533