Fixed the problem of reuploading of files already selected while using c... #118

Open
wants to merge 10 commits into
from

Conversation

Projects
None yet
8 participants

Fixed the problem of reuploading of files already selected while using click_submit_target is set without reinitialising the S3Uploader.

Ashok Fixed the problem of reuploading of files already selected while usin…
…g click_submit_target is set without reload the page
6e2691e

Is it supposed to be spelt fomrs?

Yes, its a typo error. Should be spelled as forms_for_submit

plentz commented on 6e2691e Sep 22, 2013

fomrs ou forms?

'ou' or 'or'? ;)

@ashokkumar's solution works. Without the fix, it keeps re-uploading files that you've already uploaded in addition to any new files that you've added.

For those who need the fix now, try this is your Gemfile:

gem 's3_direct_upload', github: 'ashokkumar/s3_direct_upload', ref: '06d75a9b433609018a81ad286723497d314ab48d' # S3 upload

@waynehoover Can you get this change in there so I can stop referencing GitHub in my Gemfile?

Owner

waynehoover commented Sep 18, 2014

I'm not sure why you are removing the {} replacing.

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

I find that much easier to read than

key = key_starts_with+new Date().getTime()+"-"+@files[0].unique_id+"-"+Math.random().toString(36).substr(2,16)+"/"+this.context.find('div.filename').html()

Which, by the way whats wrong with @files[0].name.split('.').pop(), this.context.find('div.filename').html() seems more brittle to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment