I have make a messaging system in which user can send messages to each other, they can also send files as attachement in message(its like simple email system).
I am facing an issue in firefox, if file name contains space(eg 602_Sign File for ticket.doc)
in firefox it’ll save with 602_Sign.doc however it should display complete name,issue is working fine on IE and chrome,below is my code for downloading file
public ActionResult Download(string attFileName)
{
string FileName = Path.Combine(Server.MapPath("~/MessageAttachmentFiles"), attFileName);
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(FileName)));
response.TransmitFile(FileName);
response.Flush();
response.End();
return null;
}
The below should work
More details on why http://kb.mozillazine.org/Filenames_with_spaces_are_truncated_upon_download