Can't link to file

Duncan Koza asked on October 3, 2019 00:47

I have created a content only page type which I use for uploading policy files to ensure the end user includes a title, policy number, approval date, etc... Also, I only permit PDF's to be uploaded.

I am able to get the file url on my policy pages by targeting the pagetype and using {% GetFileUrlByGUID(File, "") %}, but the issue I am having is when a user attempts to link to the file in the WYSIWIG editor from an other page. I tried specifying the URL pattern, but I can't get the FileGUID.

Does anyone know what I might be doing wrong?

Recent Answers


Juraj Ondrus answered on October 3, 2019 11:48

Are you using Portal engine or MVC development approach? The content only page types should be used in MVC development only. As their name says, they are content only - so they do not have links and other things like standard portal engine pages - because this is not needed in this regards in MVC - in MVC you work in the code with the URL pattern, so the actual page does not need to have these data.
In your case I would recommend either using the CMS.File page type or create a custom, standard page type for this purpose with a file upload field.

0 votesVote for this answer Mark as a Correct answer

Duncan Koza answered on October 4, 2019 00:20

Thank you.

So I have created two page types for testing. One is a clone of CMS.File and one is my own (Just a regular page type this time around with my custom fields).

I am creating a place for my organization to store all our policies, so I need custom fields like Title, PolicyNumber, ApprovalDate, PolicyType and of course the file itself (I am only going to permit PDF's from being uploaded)

I can do all that with my own custom pagetype but users can't link to it from the wysiwyg editor on their pages.

I like the CMS.file page type because it does permit users to link to it from the wysiwyg editor, but when I add new custom fields, they seem to be ignored in the form tab. What's up with that? Also, I am trying to prevent Word Docs from being uploaded yet it seems to be ignoring my restrictions to only allow PDF in the Fields menu of page types.

So, what is so special about the CMS.File Page type? and why don't my fields become visible in it?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on October 4, 2019 14:15

Are you using portal engine or MVC development?
This explains it a bit more. The CMS.File page type is special since we handle pages of this type as file - not as ASPX pages, but as a file. So, when you are inserting a link to a file (I assume you are using the "Insert image or media" button), it has to be a file page type. Your custom page type, although it has the same field, it is a normal page type so pages of this type are normal pages for the system, although you take it as a file. So, you need to be inserting link to a page if you want to link your custom file page type or use CMS.File.
If you want to limit the extensions for the file upload, what are the field settings? I have set it like this When I try uplaoding something else, I get this.

0 votesVote for this answer Mark as a Correct answer

Duncan Koza answered on October 4, 2019 15:40 (last edited on October 4, 2019 18:36)

I am using portal engine.

I have done the limits to the extension for file upload, and it works on my custom page type, but not on the clone of CMS.File.

I'd rather use a clone of CMS.File but only if I can add extra fields to it because I have a policy page that needs to show other things like approval date, policy number, etc...

Here is a picture of the fields I want:

Image Text

Here is what the CMS.File page type inforces:

Image Text

Anyway around this?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on October 7, 2019 07:54

It makes sense now. The thing is, that you can specify for example an alternative form which will be used on the Form tab or when creating new page of given type in case you want to change the look&feel. However, the CMS.File page is using the old way how to change the new/editing page on the Form tab as a show case - in this case the custom New page setting is set. (Sample screen shot). So, if you do not want to extend this "custom" new page, then just clear the value and leave the setting blank, so the form on the Form tab is generated automatically.

0 votesVote for this answer Mark as a Correct answer

Duncan Koza answered on October 9, 2019 16:56

thank you Juraj.

ok, so I am looking into this a little more. when I have everything fully figured out, I'll post here.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.