Reg: Downlaoded

  •  03-18-2010, 7:47 AM

    Reg: Downlaoded


     1. using  CuteWebUI:UploadAttachments :- iam saving the filesize and filename and other details in db.
     
    for the downloading the files, the filesize and filename will be fetched from db and below code is used for downloading.
     
    When i  download file, it is not opening , telling that no preview is available.
     
    Below is the code:-
     

    Page.Response.Clear();

    Response.ClearContent();

    Response.ClearHeaders();

    switch (FileType.ToUpper())

    {

    case "XLS": Response.ContentType = "application/ms-excel"; break;

    case "XLSX": Response.ContentType = "application/ms-excel"; break;

    case "DOC": Response.ContentType = "application/msword"; break;

    case "DOCX": Response.ContentType = "application/msword"; break;

    case "PDF": Response.ContentType = "application/ms-excel"; break;

    case "HTML": Response.ContentType = "application/octet-stream"; break;

    case "XML": Response.ContentType = "application/octet-stream"; break;

    case "XSN": Response.ContentType = "application/msinfopath"; break;

    default: Response.ContentType = "application/octet-stream"; break;

    }

    Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName + "");

    Response.OutputStream.Write( DocumentFile, 0, DocumentFile.Length);

    Response.BinaryWrite(DocumentFile);

    Response.Flush();

    Response.Close();
     
    Problem is in DocumentFile  size .
     
    Same code is working fine for asp.net file upload control. I have already mentioned in chat about this issue..
     
     
     
    Can you provide me solution.
     
    Regards
    SenthilkumarT
View Complete Thread