I am using the following code for saving the images.
if (RadUploadPageImage.UploadedFiles.Count != 0)
{
foreach (UploadedFile file in RadUploadPageImage.UploadedFiles)
{
targetFolder = "/ADDS/";
targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
string folderpath = Server.MapPath(@targetFileName);
while (File.Exists(folderpath))
{
counter++;
targetFileName = Path.Combine(targetFolder, file.GetNameWithoutExtension() + counter.ToString() + file.GetExtension());
break;
}
for (int i = 0; i < RadUploadPageImage.AllowedFileExtensions.Length; i++)
{
if (file.GetExtension().ToString() == AllowedFileExtensions[i])
{
file.SaveAs(this.Server.MapPath(targetFileName));
path = targetFileName;
break;
}
else
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "aa", "<script>alert('Image should be in .jpg, .jpeg, .png, .gif,.bmp,.tiff');break;</script>", false);
}
}
images are not displaying while publishing. How to display the images while publish the site in server. Please tell me
While running the code in my system i am able to displaying the uploaded images.
In published path i am not able diplaying the uploaded images.
Please tell me what is the wrong ?
I think the problem will be with the url of the images on the published server, you can view the source of html and see the url of the image and check if it is correct or not.