Thanks Everybody for help
I resolved the problem..the code is as below
string Dir;
Boolean flag;
string filePath;
HttpPostedFile filemain;
if (flUplLocationMap.PostedFile.FileName != null
&& flUplLocationMap.PostedFile.FileName != "")
{
filemain = flUplLocationMap.PostedFile;
filePath =
System.IO.Path.GetFileName(filemain.FileName);
//ViewState["filePath"] = "~\\RoomImages\\" +
filePath;
if (!
System.IO.Directory.Exists(AppDomain.CurrentDomain.BaseDirectory +
"RoomImages\\"))
{
///CREATE FOLDER WITH NAME OF EVENT
System.IO.Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory
+ "RoomImages");
Dir =
AppDomain.CurrentDomain.BaseDirectory + "RoomImages\\";
}
else
{
Dir =
AppDomain.CurrentDomain.BaseDirectory + "RoomImages\\";
}
System.IO.FileInfo file_name = new
System.IO.FileInfo(Dir + filePath);
flUplLocationMap.SaveAs(Dir + MaxId.ToString()
+ "_LocMap_" + filePath);
imgLocationMap.ImageUrl = "~\\RoomImages\\" +
MaxId.ToString() + "_LocMap_" + filePath;
sLocationMap = imgLocationMap.ImageUrl;
}
Thanks
With regards
Yogesh Dige.
On Jan 29, 2:21 pm, Yogesh Dige <[email protected]> wrote:
> Thanks for reply ..
>
> Even though i put the page rediect before or after the assiging the
> image then also it is not working if i press the F5 for refresh it is
> showing the new image which i uploaded..
>
> Thanks in advance
>
> On Jan 21, 12:06 am, ".NetDesigner" <[email protected]> wrote:
>
>
>
> > your code have Response.Redirect after set picture to imgLocationMap.
> > how you would expect imgLocationMap reload being?
>
> > On Wed, Jan 20, 2010 at 3:50 PM, Yogesh Dige <[email protected]> wrote:
> > > Hi all
>
> > > i am trying to upload a image file and showing that file in the pic
> > > box
> > > the file is getting uploaded properlly but the it is not showing and
> > > refreshing the image in pic box
> > > the code what i used is as follows
>
> > > Please help me out
>
> > > string sLocMap =
> > > flUplLocationMap.PostedFile.FileName;
> > > string filename = Path.GetFileName
> > > (flUplLocationMap.FileName);
> > > string sExtension = filename.Substring
> > > (filename.LastIndexOf("."));
> > > string sUploadFileName = MaxId.ToString() + "_" +
> > > txtVenueName.Text +"_LocMap"+ sExtension;
> > > flUplLocationMap.SaveAs(Server.MapPath("~/Images/
> > > RoomImages/") + sUploadFileName);
> > > sLocationMap = (Server.MapPath("~/Images/
> > > RoomImages/") + sUploadFileName);
> > > clsdb.writeLog("sLocationMap " + sLocationMap);
> > > imgLocationMap.ImageUrl = "http://
> > > 192.168.4.14:8080/MM/images/RoomImages/" + sUploadFileName;
> > > Response.Redirect("RoomDetails.aspx",true);- Hide
> > > quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -