1
I have a folder created at the root of a project Web Api
calling for Images
. In localhost
I record them as follows:
File.WriteAllBytes(HttpContext.Current.Server.MapPath("~/Images/") + image.Name, image.Image);
To display images in localhost
i just need the same address. So, in the controller I create a Viewbag that receives the image address(Ex.: http://localhost:49730/Images/Product1.jpg
) and with that code I can display her:
<a href="@ViewBag.Image">Abrir Imagem</a>
After having published in Windows Azure
when saving the image it is not being recovered from url.
What needs to be done differently than localhost
to work on Windows Azure
?
Update: before publishing in windows Azure I published the address of Azure in place of localhost, the other services work normally, only those images that are not being saved/recovered.
If I do so it takes the current address + the "/Images/Product1.jpg", the point is that I am accessing from another project, so I always add the localhost address of the web api (which is different from the localhost of my Asp.net mvc 5), and of course, before publishing in windows Azure I published the address of Azure in place of localhost, the other services work normally, only that the images are not being saved/recovered. Do you need to put this folder in a directory that exists for this type of situation?
– user8356
Look I imagined that the folder was on the server with the images!!! That’s how I could do in my opinion...
– user6026