Mike Robbins

Sitecore Developer Blog

Follow me on GitHub

Sitecore SPEAK Uploader Uploaded Item

Quite often when using the Sitecore SPEAK Uploader to upload items to the Media Library, you need to be able to access the item after upload within the JavaScript page code to work with the item.

Below is an example of how to get access to the Media Item model after it has been uploaded into the Media Library.

This method is only supported in Sitecore 7.1 rev. 140324 (7.1 Update-2). I raised this as a bug with Sitecore as Item Id's weren't returned, and its been fixed in this release.

initialize: function () {
  //Subscribe to the "upload-fileUploaded" event of the Uploader.
  //This is called after each item is uploaded successfully to the media library.
  //Specify a function to handle the uploaded event.
  this.on("upload-fileUploaded", fileUploaded, this);
var fileUploaded = function (model) {
  // Access the model for the uploaded Media Item.
  var itemId =   model.itemId