How to send other data alongside file(s) to the server? #725

Open
opened 2017-04-01 11:44:06 +00:00 by Nefcanto · 7 comments
Nefcanto commented 2017-04-01 11:44:06 +00:00 (Migrated from github.com)

What if uploading file(s) is part of a web form that needs to be submitted? I can't figure out how to use it with other input controls on a form.

Also I have difficulty making it a required field so that user should pick a file to submit the form. Is that possible?

What if uploading file(s) is part of a web form that needs to be submitted? I can't figure out how to use it with other input controls on a form. Also I have difficulty making it a required field so that user should pick a file to submit the form. Is that possible?
rbasniak commented 2017-04-01 23:25:34 +00:00 (Migrated from github.com)

I'm having the same difficulty, would really like to know how to upload the files together with other form data.

I'm having the same difficulty, would really like to know how to upload the files together with other form data.
tungphamsolver commented 2017-04-02 15:07:48 +00:00 (Migrated from github.com)

I'm having the same problem, I really want upload file and JSON object to server together.

I'm having the same problem, I really want upload file and JSON object to server together.
omarma commented 2017-04-05 15:13:16 +00:00 (Migrated from github.com)

Same issue for me :(

Same issue for me :(
ravirajhalli commented 2017-04-10 06:50:14 +00:00 (Migrated from github.com)

Same issue.. Raised issue #690

Same issue.. Raised issue #690
RahulRawat1994 commented 2017-04-27 06:50:26 +00:00 (Migrated from github.com)

Same issue....

Same issue....
bmdatl commented 2017-05-12 13:28:29 +00:00 (Migrated from github.com)

Has anyone had success with this? I am having trouble with it as well.

Has anyone had success with this? I am having trouble with it as well.
er-sarjan commented 2017-08-29 09:24:17 +00:00 (Migrated from github.com)

You can set listener for binding data along side with image.

this.uploader.onBuildItemForm = (item, form) => {
    form.append("filename", item.file.name);
    form.append("another_key", "value");
};

Found from following issue: https://github.com/valor-software/ng2-file-upload/issues/12

Hope this helps!

You can set listener for binding data along side with image. ``` this.uploader.onBuildItemForm = (item, form) => { form.append("filename", item.file.name); form.append("another_key", "value"); }; ``` Found from following issue: https://github.com/valor-software/ng2-file-upload/issues/12 Hope this helps!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#725