Property Editor w/Single File Upload
# help-with-umbraco
m
I've written a property editor that helps transcribe text to audio. The result is a base64 encoded audio/mp3 file. My only issue now is attempting to save this file and attach it to my property editor model. No matter what I search for, I find myself going in circles. Has anyone tackled this? Ideally, the file could be attached at the content & property level and NOT part of the media center. I've seen this referenced throughout the image cropper (same behavior I'm looking for in terms of attachment) and the file upload, but it doesn't seem to "do" anything.
Copy code
fileManager.setFiles({
         propertyAlias: $scope.model.alias,
         culture: $scope.model.culture,
         segment: $scope.model.segment,
         files: [
             x
         ]
     });
j
I'm not at a PC to check, but can you use the umb-property-file-upload directive? IIRC it just handles the file stuff and you can get at its value in your editor and wrap your own logic around it.
m
If I can programmatically "fake" the interaction with umb-property-file-upload directive, I might just be able to use it. Or if I could just get some daylight hours to look at this problem! 🙂 lol
In both property editors, (1) the borwser media API provides the audio file to me in chunks, and (2) the api endpoint for text to speech provides the data in base64 encoded audio/mp3. I can use the browser API to create a new File() object I suppose... I'll play around some more and report back.
j
OIC, sorry, you've already got the uploaded file - you want to save the base64 string as a file?
m
@Jason I dedicated only a small amount of time to your suggestion so far. I duplicated the "file upload" data type, as my own – and of course it works. I originally tried to duplicate the code behind this property editor / directive(s) in my own property editor - but without success. My goal is to take a file I already have (it's format is either chunked or base64) and save the file and attach it the content/property just as the file upload property editor does. This "file" is coming from the media API in the browser (example: user records their own voice with a record/stop button) or from an API service that responds with a base64 encoded file. I can use the browser native API to create a new File() object. You gave me the idea, maybe I can fake the file drag and drop with this custom File() object. Maybe not.
2 Views