Start New Discussion within our Software Development Community

hi

i have created application that uploaded files (.zip, .doc, ... any type ) to file system and then i have create another code to download the files but i need so have the option to open also the file if i do not need to save it on my computer can any one helpe me to do that
this some code how i download:

System.Web.UI.WebControls.FileUpload inputFile;
            inputFile = ((System.Web.UI.WebControls.FileUpload)Evidence_GridView.Rows[0].Cells[5].FindControl("Evidence_FileUpload"));

            if ((!(inputFile.PostedFile == null) && (inputFile.PostedFile.ContentLength > 0)))
            {
                string fileName = case_id + " " + IncroControl.getIncro() + " " + System.IO.Path.GetFileName(inputFile.PostedFile.FileName);
                string saveLocation = (this.Page.Server.MapPath(".\\Data\\Evidence") + ("\\" + fileName));
                try
                {
                    // Save the file.
                    inputFile.PostedFile.SaveAs(saveLocation);
                    CMDObj.Parameters.Add("@Attached_File", SqlDbType.NVarChar).Value = fileName;
                }
                catch (Exception ex)
                {
                    this.Page.Response.Write(("Error: " + ex.Message));
                }
            }
            else
            {
                CMDObj.Parameters.Add("@Attached_File", SqlDbType.NVarChar).Value = "";
            }

best regards,

Depending on the file, if you're downloading something to display specifically such as text, sure, otherwise if you need to pass it to an app such as zip files, word docs etc, you cant, the best you can do is temp files..

This article has been dead for over six months. Start a new discussion instead.