I am building an online book store , the upload of the pictures of the books shall be through XML web service
Now I found the code to save the image at the web service file system but The Problem is
1 - how to Build a method to get back the url of the image or the image it self
2 - how to Get the image or the image url and set to asp.net image control or other suitable control
below is the method at the web service accept parameters : 1- the image in byte array form and the 2 - file name , this method save the picture in folder called "TransientStorage" folder
[WebMethod]
public string UploadFile(byte[] f, string fileName)
{
try
{
MemoryStream ms = new MemoryStream(f);
FileStream fs = new FileStream(System.Web.Hosting.HostingEnvironment.MapPath
("~/TransientStorage/") + fileName, FileMode.Create);
ms.WriteTo(fs);
ms.Close();
fs.Close();
fs.Dispose();
return "OK";
}
catch (Exception ex)
{
return ex.Message.ToString();
}