Renaming file on-fly

    Date: 06/13/08 (Asp Dot Net)    Keywords: browser, web

    Hello,
    I do have a file on web server, let's say 123.zip
    When I am redirecting user to it, browser opens Save dialog and puts that name by default: 123.zip. Is there any way to change that name to, let's say 456.zip?
    File 123.zip stays on server as 123.zip, but user sees it as 456.zip.

    One of the known ways is:

    Byte[] data = System.IO.File.ReadAllBytes(sFullName); // 123.zip
    Response.AddHeader("Content-Disposition", "attachment; filename=456.zip");
    Response.OutputStream.Write(data, 0, data.Length);
    Response.End();

    But in this case I have to read the whole file first and then stream it out. Works fine with small files, but 123.zip could be huge. Then browser freezes and ends by timeout.

    Thank you.

    Source: http://aspdotnet.livejournal.com/98705.html

« Using DataRelation in DataSet || Postback question »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home