NetTalk Central

Author Topic: Changing the names of downloaded files  (Read 18577 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Changing the names of downloaded files
« on: July 11, 2008, 07:15:06 AM »
One question that has come up a couple times on this forum is how to change the name, prompted by the browser, when the user is saving a file to disk.

Take Example 40, as an example. This example shows you how to download a document, where the document name is passed as a parameter to a generic page. For example;

GET /ServeDocument?name=test.xls

In version 4.30 and earlier, the prompted name to save the file would be "ServeDocument". Most people would prefer for it to prompt as "test.xls".

Previously I've stated that it wasn't possible to do this, and I'm happy to say, I was wrong. It is possible. It's done by setting the content-disposition header field.

So with Version 4.31, PR6 or later, see example 40 (in the embed code in the ServeDocument procedure) for an example of how this is done.

Thanks to Robert De Jager who first showed me the technique.

Cheers
Bruce



Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Changing the names of downloaded files
« Reply #1 on: November 28, 2008, 12:02:03 PM »
Hi Bruce,
This technique works OK on my old Windows 2000 with IE6 but not in IE7 vista.
In IE6 I see the name of the proc as the name of the file, thats ok.
In IE7 I see the coplete path of the file!
Any Idea?
Regards
Alberto
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Changing the names of downloaded files
« Reply #2 on: December 05, 2008, 09:36:27 PM »
It displays whatever you set in the content-disposition header.
So in the example it's setting the full pathname - but you can set it to whatever you like.

cheers
Bruce