| | |
Images Downloading from asp.net website
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
Hello,
I have a website which allows the user to download the images from it. I used the following code. It download for most of the images but for some it tries to download as a file without extension. So can you please suggest what might be causing this.
thanks
Mythili
I have a website which allows the user to download the images from it. I used the following code. It download for most of the images but for some it tries to download as a file without extension. So can you please suggest what might be causing this.
thanks
Mythili
ASP.NET Syntax (Toggle Plain Text)
// Output standard image DataRow romImage = DAImage.GetImageByID(imageID); System.Drawing.Image image = GetImage(WebConfigurationManager.AppSettings["ImageLibraryPath"] + romImage["RelPath"]); Response.Clear(); string extension = romImage["RelPath"].ToString().Substring(romImage["RelPath"].ToString().LastIndexOf(".") + 1); Response.AddHeader("Content-Disposition", "attachment; filename=\"" + romImage["Description"].ToString() + "." + extension + "\""); Response.ContentType = "image/" + extension; System.Drawing.Imaging.ImageFormat imgFormat = System.Drawing.Imaging.ImageFormat.Jpeg ; image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
Last edited by Tekmaven; Jul 16th, 2008 at 3:11 pm. Reason: Code tags
•
•
Join Date: Jul 2008
Posts: 2
Reputation:
Solved Threads: 0
Thanks for your response. I was looking for this over a day now. The good news is I found the solution. There was no problem in the code. It is problem with how the file is uploaded. It is the description or the filename by which this file is downloaded. If the file name has / because it is a escape sequence it is not downloaded properly. Hence it appeared as if it forgot the extension suddenly in the middle of downloading the file itself.
thanks
Mythili
thanks
Mythili
![]() |
Similar Threads
- 7 Tips to Keep your PC Running At Peak Performance (Windows tips 'n' tweaks)
Other Threads in the ASP.NET Forum
- Previous Thread: Strange problem with vs 2005 when starting application
- Next Thread: how to show message box in ASP.NET using VB
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview gridview gudi iis image javascript listbox login microsoft mobile mono mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





