             else
               forms_for_submit = [data]
           else
+            console.log('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz')
             data.submit()
 
       send: (e, data) =>
         console.log('send')
         $uploadForm.trigger('show_cancel_button')
-        console.log('send point 1')
         $(selectors.cancel_upload).on 'click', (e) =>
           data.xhr().abort()
           $uploadForm.trigger('enable_all_field')

        # replace 'key' field to submit form
        unless 'FormData' of window
          $uploadForm.find("input[name='key']").val(settings.path + key)
        data

    $uploadForm.on 'show_cancel_button', ->
      $(selectors.submit).hide()
      $(selectors.cancel_upload).removeClass('hide')


    $uploadForm.on 'enable_all_field', ->
      $(selectors.s3_form).find(selectors.disable_fields).removeAttr('disabled')

    $uploadForm.on 'reset_s3_uploder', ->
      $('.upload_uploading').hide()
      $('.upload_picking').show()
      $('.progress-bar').removeAttr('style')

    $uploadForm.on 'show_submit_button', ->
      $(selectors.submit).show()
      $(selectors.cancel_upload).addClass('hide')

    $uploadForm.on 'show_cancel_button', ->
      $(selectors.submit).hide()
      $(selectors.cancel_upload).removeClass('hide')

    $uploadForm.on 's3_upload_complete', (e, content) =>
      $(selectors.s3_form).find(selectors.disable_fields).removeAttr('disabled')
      $uploadForm.find(".upload_uploading").hide()
      $uploadForm.find(".upload_finished").show().removeClass "hidden"
      $(selectors.submit).removeClass("disabled").prop "disabled", false
      $("#upload_skip_link").removeClass "hidden"
      $("#upload_s3_path").val(content.filepath)
      $(selectors.s3_form).submit()

  build_content_object = ($uploadForm, file, result) ->
    content = {}
    if result # Use the S3 response to set the URL to avoid character encodings bugs
      content.url            = $(result).find("Location").text()

#= require jquery-fileupload/basic
#= require jquery-fileupload/vendor/tmpl


$ = jQuery

