Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does Firefox trim the response file name?
    text
    copied!<p>The following code accesses a helper method which creates and returns an EPPlus ExcelPackage, then returns the package to the browser:</p> <pre><code>public ActionResult DownloadMatrixExcel(int projectId) { try { // Get project details var project = (from p in db.Projects where p.ProjectId == projectId select new { companyName = p.Company.Name, projectName = p.Name }).Single(); // Must append file type to file download responses var fileName = project.projectName + "-" + project.companyName + "-" + DateTime.Now.ToString("yyyyMMdd", CultureInfo.InvariantCulture) + ".xlsx"; // Configure response Response.Clear(); Response.BufferOutput = false; Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment; filename=" + fileName); // Create and populate excel package var matrixSpreadsheet = ExcelHelper.BuildMatrixExcel(projectId); matrixSpreadsheet.SaveAs(Response.OutputStream); } catch (Exception e) { return Content("Error: " + e.Message); } // Download okay - No ViewResult return new EmptyResult(); } </code></pre> <p>Works fine in every browser I have tested but FireFox 18.0.1 (have yet to test other FF versions) trims the file name at the first space, so "someproject - somecompany - thedate" is just "someproject". I can do a Replace and remove spaces but this makes some file names look a bit odd. File extension seems to be intact and no other issues but wondered if anyone could offer an explanation or fix? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload