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

Upload file automatically #68

Closed
claudio-ramirez opened this issue Sep 16, 2019 · 7 comments
Closed

Upload file automatically #68

claudio-ramirez opened this issue Sep 16, 2019 · 7 comments

Comments

@claudio-ramirez
Copy link

Dear.

Can someone help me with a problem that I have when uploading a file, what happens is that I want to automatically load the file when selecting the file in the input field, it is possible, in the extension ng2-file-upload (ng2FileSelect [uploader]="fileUploader") I did it without any problem, but I don't find it when trying to implement it in this extension.

Beforehand thank you very much

@AckerApple
Copy link
Owner

Use (fileChange) for when one file changes or (filesChange) when multiple files change

@claudio-ramirez
Copy link
Author

Thank you very much for the answer, but when I use fileChange it throws me an error, for example in the input of the file I use the (fileChange) = "uploadFiles", with the uploadFiles () function of the documentation example and it throws me an error and not Upload the file.

It is literally not an error, it just doesn't load the file and throws me a blocked request message (CORS), but when the uploadFiles () function assigned it to a separate button, the file is uploaded without any problem and doesn't throw me any error by CORS.

@AckerApple
Copy link
Owner

(fileChange) = "uploadFiles($event)"

CORS is a server issue on you.

You are having newbie issues. Good luck. Read like crazy

@claudio-ramirez
Copy link
Author

Thank you very much for your answer, but that is not the solution that helps me, because I could already capture the file just by sending (fileChange) = "uploadFiles (files)", but it is the FormData who does not update in real time, Since if I create a FormData in the uploadFiles function and assign it File manually (sendFormData.append ("file", file [0])) it automatically loads, my most specific question is whether there is any more automatic functionality to do this . In ng2-file-upload I used onAfterAddingFile to automatically generate the file upload, I thought that since this plugin was based on ng2-file-upload I was going to have some similar functionality, thank you very much for your answers and for your time! Regards!

@AckerApple
Copy link
Owner

AckerApple commented Oct 18, 2019

‘’’
<ngfFormData
[files] = "files"
[(FormData)] = "myFormData"
(FormDataChange) = “uploadFormData($event)”
postName = "file"

‘’’

https://github.com/AckerApple/angular-file/blob/master/README.md#practical-example

I’m a very direct person, here comes some more of that.

I see you trying to be most kind, it is most appreciated. But in some fashion you still giving me grief with your expectations comments.

This code is better structured and does not over do its duties like that other upload package.

Read the docs. Package does the job fantastically well.

@uvcreation
Copy link

@AckerApple which event helps to avoid same name file upload?

@AckerApple
Copy link
Owner

Basic JavaScript FormData has a name attribute. Each file has its own name.

Name collisions are on you

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

No branches or pull requests

3 participants