Portal Engine
Version 3.x > Portal Engine > Link to files in a document type View modes: 
User avatar
Member
Member
Darren - 11/21/2008 4:05:27 AM
   
Link to files in a document type
I'm having a problem displaying pdf files via a link in a document type. Basically I have set up a document type for company brochures and I have placed a file selection field type where users can browse to the location of the pdf file (in a sub folder created in the CMS). In the transformation I am using the GetFileURL expression to get the location of the PDF entered in that field to display in a link but I'm just getting a blank page when you click on it. Any ideas what I'm doing wrong? Am I using the correct expression?

The way I have it set up at the moment is that pdf files are uploaded using the file upload field and then I again use the GetFileURL expression. This works fine but I wanted to change it so the pdf's are physical files held in a folder so each download is logged in the web analytics module.

Hope this makes sense.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/21/2008 4:22:37 AM
   
RE:Link to files in a document type
Hi,

If you have uploaded the PDF files to the document as attachments, please see this article - http://devnet.kentico.com/Knowledge-Base/API-and-Internals/How-to-display-link-to-a-file-or-document-without-.aspx.

If the PDF files are as documents in the content tree (CMS.File document type), you can create link to them as it is usual for any other pages.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
Darren - 11/24/2008 3:39:31 AM
   
RE:Link to files in a document type
Hi Juraj,

Thanks for your reply. I have added a new class as per the instructions but it brings the site down with a runtime error. The following is logged in the event log:

error CS0103: The name 'ValidationHelper' does not exist in the current context

I think for the moment I will just create a manual link to these documents via static HTML but it would be nice in the long run to have all of them contained in document types for ease of use for the content editors.

User avatar
Member
Member
SocuteRaptor-gmail - 11/25/2008 12:49:45 AM
   
RE:Link to files in a document type
I have the same problem... Any clues?

User avatar
Member
Member
SocuteRaptor-gmail - 11/25/2008 1:37:50 AM
   
RE:Link to files in a document type
If I upload a file with extension .txt into a document, then the GetFileUrl("") works well, anh IE will show a box that allow me to choose to open or download it... But file with extension .pdf just give a blank page... I tried to manually change a pdf file's extension to .txt and reupload, and then it works well again... Rechange to .pdf... blank page...=> Extension .pdf cannot be used by GetFileUrl(""). Can you explain that?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/25/2008 4:31:00 AM
   
RE:Link to files in a document type
Hi,

Could you please send the link that is generated with the GetFileUrl method?

I have tried to add an upload field to my document type and then in transformation I used <a href="<%# GetFileUrl("field_name") %>">Link</a>.

One document has as attachment a PDF file and other document a .txt file. I have tried it in FireFox and IE7 and bot files are opened (or the dialog window is opened) and displayed fine.

Could you please tell us what is the version of CMS that you are using and also what is your transformation?

Thank you in advance.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
SocuteRaptor-gmail - 11/25/2008 4:58:07 AM
   
RE:Link to files in a document type
I used Kentico CMS 3.1 a, the free edition...

And here is my transformation:

<div style="margin-top: -15px; margin-bottom: -19px;">
<h6>▪ <a href="<%#GetFileUrl("File")%>"><%# Eval("Name") %></a></h6>
</div>


And here is the link:

http://localhost:4376/KenticoCMS/getattachment/b26bfeb4-2617-47c4-b1ca-3c0cd6247ee7/Ban-tin-thi-truong-OTC.aspx

I also try bitmap, jpeg, gif... Still OK... Just pdf gives the blank page.... T_T

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 11/25/2008 7:51:01 AM
   
RE:Link to files in a document type
Hi,

Which browser are you using to display the PDF file?
Could you please make your site accessible online so we can see this problem?

Moreover, is Adobe Acrobat Reader installed on your PC?

Best Regards,
Juraj Ondrus

User avatar
Member
Member
Darren - 12/1/2008 5:52:42 AM
   
RE:Link to files in a document type
Hi Juraj, was there any development on this?

I can't answer for SocuteRaptor but for me this problem occurs on both Firefox and IE (3.0.3 & 7.0) and yes I have Acrobat Reader installed. I don't really want to demonstrate this on my site as it's live and will be making the PDF files unavailable to my clients but trust me it happens. As both me and SocuteRaptor seem to have the same problem I expect you can replicate this behaviour.

My current setup is not ideal and I would really like to display my pdf's in this format so the downloads are logged in the web analytics.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 12/2/2008 5:32:41 AM
   
RE:Link to files in a document type
Hi,

as I mentioned before, everything is working fine in my instances of Kentico CMS. Could you please send us export package of your site to support@kentico.com and refer to this thread?

I will import it and investigate.
Thank you.

Best Regards,
Juraj Ondrus

User avatar
Member
Member
stacie-thepixelshop - 1/15/2013 1:38:20 PM
   
RE:Link to files in a document type
I am having this same issue.
I have a field in my document type to upload a pdf, and am trying to link a button in the transformation to open this pdf.
When I used the Eval("FieldName"), it is returning an empty string. I've tried uploading a .txt or a .jpg, but the result is the same.
Using GetFileUrl("FieldName") returns the following url: http://example/getattachment/00000000-0000-0000-0000-000000000000/.aspx

What is going on!?

User avatar
Member
Member
lokendra.jain-anktech.co - 1/7/2013 7:45:42 AM
   
RE:Link to files in a document type
Hi all I have an issue i need to show download link , on click of this link i need to open a dialogue box which says to save or open pdf file.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 1/7/2013 7:50:15 AM
   
RE:Link to files in a document type
Hi,

This is basically client browser setting - in the browser you can set what to do for certain file types - open them or download automatically or ask what to do. This is not a CMS setting or behavior. Or, you can use some custom javascript to override the browser settings.

Best regards,
Juraj Ondrus

User avatar
Member
Member
dhanrajm-bitwiseglobal - 8/27/2013 1:28:27 AM
   
RE:Link to files in a document type
Hi

I have upgraded the cms 2.3 to 7.0.4640,
I have a created the page which contains links od pdf, I want to open the pdf files but the pdf 's are located on the root but when i click on links it shows blank, but the same will will work when i upload the pdf in CMS.

Please let me know how to open the pdfs which are located on root (physical folder)

Regards
Dhanraj

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 8/27/2013 1:40:26 AM
   
RE:Link to files in a document type
Hi,

what do you mean exactly by "located on the root"? do you mean web site root - physical folder and the PDFs are physical files? If so, have you applied the latest hotfix? Regrettably there was a bug in handling physical files.

Best regards,
Juraj Ondrus