Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ashokkumar
Copy link

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

…g click_submit_target is set without reload the page
@kcollignon
Copy link

Is it supposed to be spelt fomrs?

@ashokkumar
Copy link
Author

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

@siliconsenthil
Copy link

'ou' or 'or'? ;)

@chrisdpeters
Copy link

@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

@chrisdpeters
Copy link

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

@waynehoover
Copy link
Owner

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants