-
Notifications
You must be signed in to change notification settings - Fork 661
Can I set item.withCredentials to false? #140
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
Comments
I suggest you extending the uploader class and set the flag when a file is added: class MyUploader extends FileUploader {
onAfterAddingFile(file: any) {
file.withCredentials = false;
}
} |
@chambersDon you should probably add your server domain address to your Access-Control-Allow-Origin header. I assume it's either not set or set with the wild card : *. Which is not authorized if you don't set the credentials to false in the XHR option (withCredentials = false). @JulioC I also need to change the credentials option. Extending the class works but it could be great to add a withCredential option at the FileUploader constructor level, like this : |
@cm0s - could you possibly provide the code to extend the class? I've been trying for a few hours and can't seem to get it to work. |
You can disable sending withCredentials before file upload: this.uploader.onBeforeUploadItem = (item) => {
item.withCredentials = false;
} |
Is there a way to set withCredentials: false in options or just one globally instead onBeforeUploadItem |
@neilhem's answer just saved my day. All I could figure out before reaching this post by sheer Google power was that my Since this ticket is still open, may I suggest logging some sort of warning to let the dev know why nothing is beeing uploaded ? Many thanks. |
Yeah, this is sad that we need so many time to figure out way disabling some options. @valorkin can we suggest PR to add a line into docs? |
Docs is always good yes, but if it's acceptable in that case I think logging some hints in the console would help a lot. I usually search the documentation based on what I understand of the problem, and in that case, there was literally no clue. |
I have been having a problem with the post. When I click 'upload all' the progress bar moves but it never actually posts the file. I don't see any errors.
I stumbled across the problem on line 329 of file-uploader.ts.
xhr.withCredentials = item.withCredentials;
If I change this to xhr.withCredentials = false; it will work.
Is there a way to set this as a property from outside?
I am setting the authToken. When withCredentials is false I get the post on the server side and it is authenticated. My angular2 client is a different site than the webApi it calls. CORS is setup and I am getting the post when withCredential is false.
I'm not really sure what this is doing but I know if has something to do with cross-site scripting.
Can I set it to false from outside?
Is that the proper fix?
The text was updated successfully, but these errors were encountered: