 
   setUploadForm = ->
     $uploadForm.fileupload
-      url: settings.url
+      url: $uploadForm.data('s3-url')
       add: (e, data) ->
         file = data.files[0]
         file.unique_id = Math.random().toString(36).substr(2,16)

    before_add: null
    remove_completed_progress_bar: true
    remove_failed_progress_bar: false
    progress_bar_target: null
    click_submit_target: null
    allow_multiple_files: true
    used_fields: ['utf8', 'key', 'acl', 'AWSAccessKeyId', 'policy', 'signature', 'success_action_status', 'X-Requested-With', 'content-type', 'file', 'x-amz-server-side-encryption']
    url: null
    disable_fields_after_submit: null
    allow_send_form_without_file: false


    disable_fields: 'textarea,input[type=text],input[type=checkbox],select'
    file_name_for_upload: '#file_name_for_upload'

  $.extend settings, options

  current_files = []
  forms_for_submit = []
  validation_form = true

  $uploadForm.find('.file-field').on 'change', ->
    # Populate thumb
    if this.files && this.files[0] && /^image/.test(this.files[0].type) && window.FileReader isnt 'undefined' && Modernizr.canvas
      # Browser supports File and Canvas APIs
      file = this.files[0]

      loadImage.parseMetaData file, (img) ->
        # Get orientation
        ornt = if img.exif? then img.exif.get("Orientation") else 1

        # Set thumbnail
        loadImage file, ((img) ->
            imgElem = $(img)
            imgElem.addClass 'img-responsive'
            container = $("#upload_thumbnail").parent()
            container.children().remove()
            container.css 'text-align': 'center'
            container.append imgElem
          ),
          maxHeight: 90
          orientation: ornt
          canvas: true
    else
      # Fallback; just use a placeholder
      $('#upload_thumbnail').show().attr('src', assetPath('media/mrx-placeholder-120x90.png'))

  if settings.click_submit_target
    settings.click_submit_target.click =>
