Image update problem
-
Hi, I have an image, file upload and a button control on my webform. I am uploading a new image and attaching the image to replace my existing image in button click event. It seems to work fine on my local machine. When I deploy and run on the server side, the image upload is working fine, the image is getting replaced in the background. However my web page still shows old image. If I reload the page then it shows the updated image. I am using the same name for the image when I am doing save as in the button click event. Any inputs why this is happening? Appreciate inputs
Raj D
-
Hi, I have an image, file upload and a button control on my webform. I am uploading a new image and attaching the image to replace my existing image in button click event. It seems to work fine on my local machine. When I deploy and run on the server side, the image upload is working fine, the image is getting replaced in the background. However my web page still shows old image. If I reload the page then it shows the updated image. I am using the same name for the image when I am doing save as in the button click event. Any inputs why this is happening? Appreciate inputs
Raj D
I belive, you are not loading the image after the image is uploaded. Could you please post your code for better assistance?
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group
-
Hi, I have an image, file upload and a button control on my webform. I am uploading a new image and attaching the image to replace my existing image in button click event. It seems to work fine on my local machine. When I deploy and run on the server side, the image upload is working fine, the image is getting replaced in the background. However my web page still shows old image. If I reload the page then it shows the updated image. I am using the same name for the image when I am doing save as in the button click event. Any inputs why this is happening? Appreciate inputs
Raj D
-
I belive, you are not loading the image after the image is uploaded. Could you please post your code for better assistance?
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group
I have the Image1.ImageURL set to the same jpg filename that I am not changing. So in page load event caused by the button click event the image needs to be loaded. If it is reading from the server then it should show the new uploaded image. However it seems to be not retrieving this data from server. Please see the code below that I used. I even set the Image1.ImageURL in the page load event.. Still does not work. It works great on my local system. Please advice
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Image1.ImageUrl = "_SiteURL here_/images/studios/S-arc-0001.jpg" End Sub Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click Response.Cache.SetCacheability(HttpCacheability.NoCache) If FileUpload1.HasFile Then FileUpload1.SaveAs(MapPath("~/images/studios/S-arc-0001.jpg")) Image1.ImageUrl = "_Site URL here_/images/studios/S-arc-0001.jpg" End If End Sub
Raj D
-
I have the Image1.ImageURL set to the same jpg filename that I am not changing. So in page load event caused by the button click event the image needs to be loaded. If it is reading from the server then it should show the new uploaded image. However it seems to be not retrieving this data from server. Please see the code below that I used. I even set the Image1.ImageURL in the page load event.. Still does not work. It works great on my local system. Please advice
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Image1.ImageUrl = "_SiteURL here_/images/studios/S-arc-0001.jpg" End Sub Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click Response.Cache.SetCacheability(HttpCacheability.NoCache) If FileUpload1.HasFile Then FileUpload1.SaveAs(MapPath("~/images/studios/S-arc-0001.jpg")) Image1.ImageUrl = "_Site URL here_/images/studios/S-arc-0001.jpg" End If End Sub
Raj D
dasumohan wrote:
Image1.ImageUrl = "SiteURL here/images/studios/S-arc-0001.jpg"
You are using the Absolute URL for Image Path. Use relative path. Say,
Image1.ImageUrl = "images/studios/S-arc-0001.jpg"
dasumohan wrote:
Response.Cache.SetCacheability(HttpCacheability.NoCache)
If you need the Cacheability, set it in the Page Load event. The relative path may solve your problem.
Regards, Venkatesh Mookkan. Software Engineer, India My: Website | Yahoo Group
-
Hi, I have an image, file upload and a button control on my webform. I am uploading a new image and attaching the image to replace my existing image in button click event. It seems to work fine on my local machine. When I deploy and run on the server side, the image upload is working fine, the image is getting replaced in the background. However my web page still shows old image. If I reload the page then it shows the updated image. I am using the same name for the image when I am doing save as in the button click event. Any inputs why this is happening? Appreciate inputs
Raj D