Image control

L

luci

Hi,
i'm writing a pice of code to fill the image control (in asp.net page)
with a image uploaded on the server.


The way I used is this:
protected void cmdUpload_Click(object sender, EventArgs e)
{
thumbUpload.SaveAs(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image largeImg =
System.Drawing.Image.FromFile(Server.MapPath("/public/news/_tmp_news.jpg"));
System.Drawing.Image thumbImg =
largeImg.GetThumbnailImage(120, 120, null, IntPtr.Zero);
largeImg.Dispose();

thumbImg.Save(Server.MapPath("/public/news/_tmp_news.jpg")); //Resave
the thumb
thumbImg.Dispose();
imgThumb.ImageUrl = "/public/news/_tmp_news.jpg";

....................



Why when i try to upload again a new image the images don't change?

The image control always show the first image i uploaded, (in cache?)

DUNNO!
 
B

bruce barker \(sqlwork.com\)

thats because the browser caches images. the easiest fix is decorate the
url:

myimage.jpg?i=<random number>

-- bruce (sqlwork.com)
 
L

luci

bruce barker (sqlwork.com) ha scritto:
thats because the browser caches images. the easiest fix is decorate the
url:

myimage.jpg?i=<random number>

-- bruce (sqlwork.com)
I Supposed!
There's a method to clear the cache? just to know!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top