Closed tatsujb closed 6 years ago
I don't see anything special in there. Everything you can do with Dropzone you can do with this wrapper and almost exactly the same way. All this wrapper does is initializes dropzone according to the config and monitors for changes in the config. So without more specific question I can not help you. If you are just asking how to use this wrapper then other forums might be better since not so many users monitor these issue.
thanks,
please forgive my noobyness
header
and method
I get where I could put, but will
init: function() {
const dz = this,
action = dz.element.action,
sas = dz.element.dataset.sas;
dz.on("processing", (file) => {
dz.options.headers["Content-Type"] = file.type;
dz.options.url = `${action}/${settings.country}/${settings.language}/${file.name}?${sas}`;
})
work if I also put it in DEFAULT_DROPZONE_CONFIG
?
All dropzone events are usable as outputs so no need to use the 'on' method. When you need to modify the dropzone instance in the event handler you need to get the the dropzone instance which can be get using dropzone() function through the directiveRef (see README / example app). Then you can update the options in the dropzone instance normally.
Thanks for having already taken some time 👍
something like this? :
const DEFAULT_DROPZONE_CONFIG: DropzoneConfigInterface = {
url: 'http://localhost:8080/purchaseorders/import',
maxFilesize: 5000,
method: "PUT",
headers: {"x-ms-blob-type": "BlockBlob"},
init: function() {
this.dropzone().options.headers["Content-Type"] = file.type;
this.dropzone().options.url = `${this.dropzone().dz.element.action}/${settings.language}/${settings.language}/${file.name}?${this.dropzone().element.dataset.sas}`;
}
};
I still don't understand in that code what I should set as file.type
settings.country
and settings.country
.
would this.dropzone().type
work for file.type
, for example?
navigator.language
for settings.language
and hard coded "US" or "FR" for settings.language
?
many thanks
You might need to study the basics of Angular first before trying to do something as complex. Hopefully somebody has more time to give you ready examples.
believe me I'd love to have the time but my boss won't hear it.
the "basics of Angular" according to you aren't what's universally understood when people use those words in conjunction. I've gotten, by now, the memo that you're good.
I'm new to angular but I'm a bit beyond what I define as the "basics".
being able to upturn the entrails of any angular npm plugin I may come across with ease isn't exactly "basic".
for future reference (others who might have the same question &/or level as me) I found this stack overflow : https://stackoverflow.com/questions/38781909/webkitformboundary-included-in-file-payload-on-direct-upload-to-s3/39091650#39091650
and with slight modifications I managed to get it working :
const DEFAULT_DROPZONE_CONFIG: DropzoneConfigInterface = {
url: '/purchaseorders/import',
maxFilesize: 5000,
method: "POST",
headers: {"Content-Type": "text/csv; charset=windows-1252"},
init: function() {
const dz = this;
dz.on("sending", function(file, xhr, formData) {
const _send = xhr.send;
xhr.send = function() {
_send.call(xhr, file);
}
});
}
};
Well this is a profession where you learn every day :) I just try to re-direct the usage support questions more towards stackoverflow since it really is better place than git issues for finding and getting help. And I can only offer solutions that are more Angular based (since I am not that familiar with dropzone) so nice to see that there was also "pure" dropzone way to do it.
apparently this is possible via this fix : https://github.com/enyo/dropzone/issues/590#issuecomment-51498225
I don't get how I would implement this in this package, though?