         virtualAttr = "#{container.data('parentType')}[new_#{container.data('association')}_uuids]"
         hiddenField = "<input type='hidden' name='#{virtualAttr}[]' value='#{uuid}' />"
         container.append(hiddenField)
+      publishEvent(container, "upload:success", [ uuid, filename, privateUrl ])
     error: (xhr) ->
       console.log xhr.responseText
 

  else
    alert("File could not be uploaded")

publishEvent = (name, detail) ->
  ev = document.createEvent "CustomEvent"
  ev.initCustomEvent name, true, false, detail
  document.dispatchEvent ev

saveUrl = (container, uuid, filename, contentType, publicUrl, progressColumn, fileColumn) ->
  privateUrl = null

      public_url: publicUrl
    success: (data, status, xhr) ->
      privateUrl = data.private_url
      if privateUrl == null
        displayFailedUpload(progressColumn)
      else
