Developer forum

Forum » Templates » Display file in browser

Display file in browser

Anders Ebdrup
Reply

Hi guys,

 

How do I display a file in the browser - e.g.

<a href="/files/products/datasheet.pdf" target="_blank">datasheet</a>

But still would like the tracking from the "/admin/public/Download.aspx"?

If I am using this method:

<a href="/admin/public/Download.aspx?file=/files/products/datasheet.pdf" target="_blank">datasheet</a>

Then it seems to force download of the file and not just displays in file in a new window. Any experience about this?

 

Best regards, Anders


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

You can add &ForceDownload=False - then it is up to the browser if it should be displayed inline.

 

BR Nicolai

Votes for this answer: 1
 
Anders Ebdrup
Reply

Original message by Nicolai Høeg Pedersen posted on 20/11/2013, 20:56:

You can add &ForceDownload=False - then it is up to the browser if it should be displayed inline.

 

BR Nicolai

Thanks for a very quick reply!

 

I have tried that parameter, but for that to work there seems to be a missing else part in this if-statement

		If Base.ChkBoolean(Base.Request("ForceDownload")) Then
			Redirect = False
		End If

So I am looking for a solution where "Redirect" can be set to true

 
Nicolai Høeg Pedersen
Reply

Well, it is followed by these line:

 

 If Redirect Then
            Response.Redirect(FilePath)
            Response.End()
 End If
 
Anders Ebdrup
Reply

 

Original message by Nicolai Høeg Pedersen posted on 20/11/2013, 20:56:

Well, it is followed by these line:

 

1
2
3
4
If Redirect Then
           Response.Redirect(FilePath)
           Response.End()
End If

Yes, but how to make the "Redirect" variable true? :-)

 
Nicolai Høeg Pedersen
Reply

Hm, implemented, never tested.

 

You are right I guess.... Damn it :-)- TFS#13675, comitted and fixed.

 
Anders Ebdrup
Reply

Original message by Nicolai Høeg Pedersen posted on 20/11/2013, 20:56:

Hm, implemented, never tested.

 

You are right I guess.... Damn it :-)- TFS#13675, comitted and fixed.

Hi Nicolai,

 

Thanks, sounds great! When will this be released? And do you have a workaround in the meantime??

 

Best regards, Anders

 
Nicolai Høeg Pedersen
Reply

It will be out in next hotfix

 

You must be logged in to post in the forum