I know that with the API that's behind it all you have to do is this:
var ms = Services.MediaService; var mediaImage = ms.CreateMedia(fileName, parentMediaId, mediaTypeAlias); mediaImage.SetValue("umbracoFile", fileName, new MemoryStream(bytes)); ms.Save(mediaImage);
So if you pass something in that's a stream it might just work already.
Saving a file with mediaResource.save
Anyone who knows how to use the mediaResource.save function to save a new file, fx. a pdf?
The documentation, which can be found here, is not especially detailed. http://umbraco.github.io/Belle/#/api/umbraco.resources.mediaResource
Well, as a bitsteam or as a link or what? How do I pass the files?
I know that with the API that's behind it all you have to do is this:
So if you pass something in that's a stream it might just work already.
Jeroen
Tom, did you ever find an answer to this?
yeah, Jeroens answer more or less worked.
So there is still no way to do this from a frontend property editor?
I'd be interested to know if anyone found out anything more about the angular
mediaResource.save()
for new media items?is working on a reply...