I am working on an Umbraco 4 site which has lots of documents available to download in .doc, .docx and .pdf format.
The files are all stored in the Umbraco Media node and linked on the content pages.
The links all work in the respect that they point to the right files, and if I right click/save as or save link as, I can download them all just fine.
My problem is that with a left click, the save as dialog does not appear, Umbraco attempts (and fails) to open them in the browser and I'm getting a 404 error.
Must implement a class that inherits from IHttpHandler and implement the ProcessRequest() method which should take care of setting the required header info as Petr suggests. Once ready, compile project and throw assembly in /bin folder (or add .cs file to App_code folder) and register the handler in your web.config.
Sorry Dirk, you've lost me - I know how to create a handler (.ashx) to do this, but this would mean each link would have to point to the handler - I need users to be able to add links to file in the media node using tinyMCE, and for these links to force the save as dialog.
Would your method allow this? If so, I'm unsure how to process.
I'm not sure it is actually Umbraco that is doing this. It could just as well be your IIS that is not sending a suitable content header. How are you hosting your site? Own/shared server? IIS 6/7? Classic mode/ integrated pipeline?
I thing there are many ways to handle this depending on your setup. Also without creating a "proxy" handler.
Force "Save As" for .doc/.docx/.pdf files?
Hello,
I am working on an Umbraco 4 site which has lots of documents available to download in .doc, .docx and .pdf format.
The files are all stored in the Umbraco Media node and linked on the content pages.
The links all work in the respect that they point to the right files, and if I right click/save as or save link as, I can download them all just fine.
My problem is that with a left click, the save as dialog does not appear, Umbraco attempts (and fails) to open them in the browser and I'm getting a 404 error.
How can I force the save as dialog?
Many thanks,
Olly
You can create handler, which send content-disposition header, which should force browser to display download dialog.
Thanks Petr, do you have any idea how to implement this in Umbraco?
Olly,
Must implement a class that inherits from IHttpHandler and implement the ProcessRequest() method which should take care of setting the required header info as Petr suggests. Once ready, compile project and throw assembly in /bin folder (or add .cs file to App_code folder) and register the handler in your web.config.
Hope this helps.
Regards,
/Dirk
Sorry Dirk, you've lost me - I know how to create a handler (.ashx) to do this, but this would mean each link would have to point to the handler - I need users to be able to add links to file in the media node using tinyMCE, and for these links to force the save as dialog.
Would your method allow this? If so, I'm unsure how to process.
Many thanks for your help so far.
Olly
I'm not sure it is actually Umbraco that is doing this. It could just as well be your IIS that is not sending a suitable content header. How are you hosting your site? Own/shared server? IIS 6/7? Classic mode/ integrated pipeline?
I thing there are many ways to handle this depending on your setup. Also without creating a "proxy" handler.
You'll probably need to add the MIME types to iis - http://support.microsoft.com/kb/326965
Dan
Thanks Dan, didn't even consider this as I incorrectly thought the site was hosted on the same IIS as another which was working fine. All good now.
is working on a reply...