Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

set files content type

  • Loading branch information...
commit 7797523346986fc7c9ddec75da72e109a534cf7b 1 parent c4418ab
@ncri ncri authored
View
1  .gitignore
@@ -5,6 +5,7 @@ spec/gallery-jquery-fileupload
.bundle
.config
.yardoc
+.idea
Gemfile.lock
InstalledFiles
_yardoc
View
14 app/assets/javascripts/s3_direct_upload.js.coffee
@@ -27,4 +27,16 @@ jQuery ->
fail: (e, data) ->
alert("#{data.files[0].name} failed to upload.")
console.log("Upload failed:")
- console.log(data)
+ console.log(data)
+
+ formData: (form) ->
+ data = form.serializeArray()
+ fileType = ""
+ if "type" of @files[0]
+ fileType = @files[0].type
+ data.push
+ name: "Content-Type"
+ value: fileType
+
+ data
+
View
1  lib/s3_direct_upload/form_helper.rb
@@ -65,6 +65,7 @@ def policy_data
["starts-with", "$utf8", ""],
["starts-with", "$key", ""],
["content-length-range", 0, @options[:max_file_size]],
+ ["starts-with","$Content-Type",""],
{bucket: @options[:bucket]},
{acl: @options[:acl]}
]
Please sign in to comment.
Something went wrong with that request. Please try again.