       public_url: publicUrl
     success: (data, status, xhr) ->
       privateUrl = data.private_url
-      publishEvent "upload:success", { uuid: uuid }
       if privateUrl == null
         displayFailedUpload(progressColumn)
       else

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


  else
    alert("File could not be uploaded")

publishEvent = (target, name, detail) ->
  $(target).trigger( name, detail )

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