-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
[WIP] Use uploader objects #54
[WIP] Use uploader objects #54
Conversation
This is possible currently with |
I'm not opposed to this, just want to keep the API minimal / explicit. (It does look like a nice abstraction, but I'm not sure how often this would need to be overridden) |
If it's that rare that more flexibility with the uploader is needed then I agree this is probably unnecessary. When rails 5.2 is released though I imagine there will be more people looking for this functionality. Either way it was a good exercise putting it together |
Ahh, cool. Could you write your requirements here, or outline what's needed? I'm super unfamiliar with uploading binary files, so it's a feature that's more community driven. |
Actually, I think after sitting on this for a week, I'd be okay with this.
|
👍 will get onto it this week |
@Subtletree this one is quite amazing, I think some issues that I have with uploading to S3, might be solved by this change. Do you think you can give some examples here, how to use it in the proper way (docs)? :) Thank you! |
I would hold off until this gets merged for docs, since things may change. |
I've allocated some time this weekend to hopefully get this sorted. @RuslanZavacky If you want help in the meantime feel free to ping me on the ember slack 🙂 |
Sorry, not the intention to close this. |
Let me reopen the master branch temporarily 🙃 |
I've hit a bit of a road block on my last couple of attempts to get this across the line. A The current code works by passing the I've tried several methods of injecting the I'll ask on slack if anyone with more experience in this area can take a look. |
Ahh, yeah. That'd be tricky. I can try to instantiate the file using the container; that may help quite a bit |
Sadly, I think it may break some of the niceness that comes from |
Hey @Subtletree! I have taken over maintaining this addon. |
@Alonski Now I'm back from holiday I would like to revisit this. I think that the same thing could be accomplished much more simply by making the contentType customizable for
I think the 'uploader' idea would be useful in some situations but is mostly unnecessary. I'll have a better think about this later, whether to continue this pr or make a new one to edit Good effort taking over the addon btw 🙂 |
@Subtletree That sounds like a good idea. Test it out and if it works we can get the new PR merged in :) |
@Subtletree Would love to see this revisited. If not then this will be closed soon 🙂 |
I'm closing this PR and am putting aside some time to work on the simpler method mentioned above. I'm still using this branch in production.. so I'm keen to add this functionality into master and upgrade from v2.1.1 😅 |
Currently it's not trivial to customize how a file is uploaded.
A scenario:
I'm testing the new activestorage module in edge rails 5.2 for direct uploads.
It sends the client a signed s3 upload URL with a
Content-MD5
header of the expected data's checksum. That data is just the file itself, not form data.Therefore I need to override
ember-file-upload
to send just the file and not wrap it in a form.This PR makes customizations like this easy by moving the uploading logic from the
file
model to 'uploader' objects, in the same style as ember-data's serializers/adapters or ember-simple-auth's authenticators.3 uploaders are included by default:
To solve the above scenario I could create an
uploaders/application.js
file which would be used by default:Or pass the uploader in when uploading the file:
Or create a custom uploader to do whatever I want:
I'm using this fork in production currently.
It needs some polishing and documenting but wanted to gauge interest in moving in this direction 🙂
These issues would be easily solved #9, #43