I'm creating a Dashboard SPA in with AngularJS. The page will be hosted in Kentico.
There is a need to allow user to upload attachments to associate with data records displayed in the SPA. I've already ruled out uploading files via the REST service due to the need of Base64 encoding the binary.
My plan is to implementing the SPA markup in a page's layout. The markup will include a webpartzone element which will allow dropping in the media file uploader webpart.
It looks like the direct path to an uploaded file can be derived via the pattern:
<media library base URL>/<Library name>/<file name>
On a test page, I have enabled the updatepanel flag on the media uploader webpart to prevent a full POST back. All seems to work on a test page, except I don't know what/if any event there is to subscribe for the successful upload. I need to subscribe to the file uploader's event to store a reference to the attachment.
Any suggestions?
if you have the FileGUID available the easiest way to build the url is following:
/getmedia/<FileGUID>/<name, filename or anything else including random string or nothing at all>
Thanks Jan, the other issue is how to be notified once the upload is successful. Is there an event that gets triggered upon successful upload of the file? I can only persist the attachment URL after successful upload.
This might help you with the events. You would use something like:
MediaLibraryInfo.TYPEINFO.Events.Insert.After +=
Thanks Zachary.
I was referring to client-side events. In the context of doing the upload in a SPA angular app. My client side app needs to be notified when the upload was successful so I can persist the attachment URL via the SPA app. Can't use server-side events handlers since Kentico is not inherently aware of association of an attachment with a data record in my custom table.
Please, sign in to be able to submit a new answer.