1

Sitecore Version : 9.0.2

Environment: Azure PaaS CD

If upload any media file manually in Content editor, it uploads the media and the filepath field is empty. In program, I need to upload the media files which I could able to upload the file and the filepath field is not empty, it shows App_Data/Mediafiles/filepath.ext . The issue is I could able to see the media files in CM server. I have published all the media library to CD server. Only manually uploaded files are showing in live website, the media files which is created through program are not showing in live website.

2

The fact that the filepath is not empty when uploading through your code would mean that those items are uploaded as file based. This means Sitecore will store the actual blob on disk and not in the database. To get those items to a CD server, you would need a solution that copies those files along. But that is not your best solution, as you probably don't want them on disk (as your manually inserted media is in the database).

Check your code - I would assume that you have some MediaCreatorOptions. If my assumptions are correct, those options would have options.FileBased = true; You need to change that to false in order to get the blob items stored in the database. In that case, your filepath will be empty and if those get published, your CD will have access.

You can check this blog for more info: https://briancaos.wordpress.com/2009/07/09/adding-a-file-to-the-sitecore-media-library-programatically/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.