I'm developing a package for the new Umbraco 11 version, In there I need to create media and get its URL using byte stream. Seems it's a bit different from the older version such as version 7/8. Can anybody suggest me way of doing it or clear documentation or an article that I can get some support?
Asked
Active
Viewed 201 times
2 Answers
1
I think you're looking for this example, it's from the official Umbraco 9+ docs: https://docs.umbraco.com/umbraco-cms/reference/management/services/mediaservice#creating-a-new-media-item-from-a-stream

Jannik Anker
- 3,320
- 1
- 13
- 21
-
1Let me know how it goes (and remember to mark the question as answered if everything goes well :-) )! – Jannik Anker Jan 11 '23 at 13:57
-
As I'm using Umbraco 11 version. when setvalue method as below void SetValue(string propertyTypeAlias, object? value, string? culture = null, string? segment = null); I think its different than one call in documentation. – Eranga Wijethunga Jan 11 '23 at 14:03
-
SetValue Method signature bit different in Umbraco 11 than mentioned in the documentation it accepts only the above parameters. But I need to set the value for the media URL. If I parse only the first two parameters it only creates a dummy file in Umbraco media , not actual image I added. – Eranga Wijethunga Jan 12 '23 at 07:37
-
You're right, it looks like there's something strange going on with the docs :-/ And you are saying that if you call SetValue like media.SetValue("umbracoFile", stream) it still doesn't work? Have you debugged your way through to make sure it's not your stream that is empty? – Jannik Anker Jan 12 '23 at 15:26
0
I got the support from Umbraco forum for this issue and now it's solved. Please follow this URL https://our.umbraco.com/forum/using-umbraco-and-getting-started/110866-umbraco-11-create-media-from-stream

Eranga Wijethunga
- 185
- 8