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 ?
我认为问题可能出在已发布服务器上的图像的url,您可以查看html的源并查看图像的url并检查其是否正确。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.