0

After uploading the image using ng-file-upload to https://angular-file-upload-cors-srv.appspot.com/upload

,I get in response only the image name.

Now, if I want to render the image in html

 <img ng-show="createRecipeForm.file.$valid" src="{{response.filename}}" class="img-rounded"  height="100">

or

 <img ng-show="createRecipeForm.file.$valid" ngf-thumbnail="{{imageArray[$index]}}" class="img-rounded"  height="100">

How do I get my image here? I am using this for demo purpose and need to get it from my local computer only for now.

I see can not give path to a drive on computer here for src.

So, how do I render the image in html given that I have the file name.

1 Answer 1

1

If you are storing the file using a web server, you should have access to the relative path of the server to use before filename in src="{{response.filename}}"

Check where in the folder structure you are storing them, then you can try: (e.g.)

src="/AppData/{{response.filename}}"
Sign up to request clarification or add additional context in comments.

2 Comments

But what if I do not want to save the file anywhere and just hold it in scope against a ng-model, save in an array on upload and then rende from that array? Is that posible?
The file needs to be stored somewhere. Angular itself won't store a thing, the browser may do it, but this storage is limited.

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.