[Using the attachment file in CMS admin with CMSEditableRegion]

duy luu asked on September 12, 2019 10:21

Hi all,

I have problem with using the file attachments. I upload the file pdf to the page using the attachments and i don't known the URL for read that file on browser like: https://domain.com/filename.pdf I just want to upload the file to the CMS admin and using tag <a html set the URL of the file was upload in the CMS by CMSEditableRegion on CMS. the document of kentico show the way to upload file and i don't know to use it. Any way to define the URL of the file update on CMS?

Thanks all.

Recent Answers


David te Kloese answered on September 12, 2019 13:05

In an editable region you can use the "Insert Link" item:

Image Text

And select one of the attachments (or upload a new one):

Image Text

Depending on your configuration it will insert a link like this: Image Text

(When using permanent URL's will add a unique GUID instead of the path)

1 votesVote for this answer Mark as a Correct answer

duy luu answered on September 12, 2019 17:44

Thanks a lot. The guideline very helpful. But i have problem with the URL of the file attachment. I upload the file and click the link and receive the message: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.". It some things wrong with url when upload or I must upload the file by other way because i not see the /getattachment/ url

Thanks

0 votesVote for this answer Mark as a Correct answer

jamun tar answered on September 13, 2019 12:55

Thank you that was helpful

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on September 16, 2019 10:00

@duy luu - what is the URL when you select an attachment? Is it the same as your main domain setting?

Did you make any changes to the editable region Web Part?

0 votesVote for this answer Mark as a Correct answer

duy luu answered on September 16, 2019 17:06

@David te Kloese - The URL when i upload the file is : /getattachment/lp/LandingPage/pint2-min.png?lang=en-US

  • The URL of the page is : https://domain/lp/lp1.

And when click the link file attchment it redirect to that link: http://domain/getattachment/lp/LandingPage/pint2-min.png?lang=en-US

with content: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. I don't known how to define the link store the file upload. The Page URL Path i use custom URL path or not but it not work. Could you have some idea and guide line for that. Thanks you a lot.

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on September 17, 2019 11:31

If you go to the attachments overview of that particular page does the preview work?

What kind of url does it render?

https://content.screencast.com/users/DavidTK/folders/Jing/media/a9dd090a-1c6c-4f93-80c9-34fda418b7e1/2019-09-17_1128.png

For me something like:

https://domain/cms/getattachment/ce0d4f46-....-038ea15eef35/lightbulb.png.aspx?chset=6eb17f26-....-4899a02e233c

Which also works as a live url when I use:

https://domain/getattachment/ce0d4f46-....-038ea15eef35/lightbulb.png.aspx?

1 votesVote for this answer Mark as a Correct answer

duy luu answered on September 17, 2019 14:40

@David te Kloese . It's still not work on Preview mode :( When i open the file upload on Attachments it redirect to URL:

https://domain.com/cms/getattachment/8efec7cb-c429-4c73-aad4-0349451ef472/pint2-min.png?chset=da41441b-61cb-4359-a3ef-97d375cbc7ea

and it not work with URL : https://domain.com/getattachment/8efec7cb-c429-4c73-aad4-0349451ef472/pint2-min.png?chset=da41441b-61cb-4359-a3ef-97d375cbc7ea

It always get the message : "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." :(

In the "Settings" of URL and SEO, I checked in "Redirect page aliases to main URL". It's affect to the URL of the file upload? It's any config i need to be change for define the URL of file upload? Thanks.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 19, 2019 12:04

What are the extension settings? I mean under URLs and SEO settings -> Files friendly URL extension. It should be either blank or .aspx. Also, you may need to follow this guide to enable friendly URLs and extensions. Especially the runAllManagedModulesForAllRequests attribute in the web.config file may be required.
Then also, when you remove the chset query string parameter from the URL, does it work? This one is used in the admin UI so you need to be logged in.

1 votesVote for this answer Mark as a Correct answer

duy luu answered on September 19, 2019 17:03

Hi @Juraj Ondrus,

I was log in on CMS with admin account, The config "Files friendly URL extension" was empty (blank) in settings. The file web.config already have the runAllManagedModulesForAllRequests = true. I also tried to remove the chset query string parameter from the URL but not work. I think when i upload the file on the CMS, the alias path may be not correct : http://domain.com/cms/getattachment/3504cf09-42ce-4861-b2c9-949095eecad6/Genesis_-_IND_Credit_Protection_Addendum_-_190510.pdf?chset=98c353c6-6e33-4c44-b4e1-67b957a3ea8e&disposition=attachment. I'm not see the /getattachment in the CMS.:( Thanks you.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 20, 2019 06:43

The URL is correct - well, if you check the GUID and compare it with CMS_Attachment table, you should find a record for given attachment with given AttachmentGUID. The /getattachment part is generated automatically and the code is in a DLL, so you cannot see it in the project. So, maybe the issue is that the attachment is not present in the DB? Are you storing files in the DB ort in file system or both? Are you using workflows? If yes, is the page in question published?

0 votesVote for this answer Mark as a Correct answer

duy luu answered on September 24, 2019 10:49

I checked in database and found the AttachmentGUID was matched with link URL in attachment files. I tried to store files with file system and store in DB on files config in "Settings" module. But it still not work.I don't know if there are any settings/ config that affect the display/ set the link of files attachment. Thanks for your help

0 votesVote for this answer Mark as a Correct answer

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