0

I have a service which allows to fill information about some object. One of the attributes is picture. Before now I used to upload picture through file open dialog from desktop. Now want to make it possible to load picture by URL, but I have no idea how to load it by URL and make it a form-data parameter (so that both ways were possible). I'm constructing form-data like this

var fd = new FormData();
fd.append("img", imgFile);
fd.append("data", "somedata")

1 Answer 1

1

Try this implementation. Uploading files and JSON data in the same request with Angular JS

Sign up to request clarification or add additional context in comments.

2 Comments

I have no problem with downloading JSON and files together. I have problem with supporting both variants of upload: through openFileDialog and through URL
When you are entering URL, try downloading it and append it file(images) array. then you can use same implementation that you have for File Dialog. Hope this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.