Skip to content

Commit

Permalink
Replace {extension} placeholder on key option with file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
danxexe committed Feb 14, 2014
1 parent 232958f commit f361220
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/assets/javascripts/s3_direct_upload.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ $.fn.S3Uploader = (options) ->
name: "content-type"
value: fileType

key = $uploadForm.data("key").replace('{timestamp}', new Date().getTime()).replace('{unique_id}', @files[0].unique_id)
key = $uploadForm.data("key")
.replace('{timestamp}', new Date().getTime())
.replace('{unique_id}', @files[0].unique_id)
.replace('{extension}', @files[0].name.split('.').pop())

# substitute upload timestamp and unique_id into key
key_field = $.grep data, (n) ->
Expand Down

0 comments on commit f361220

Please sign in to comment.