如何在ASP.Net中以编辑模式获取图像路径 [英] How to get the image path in edit mode in ASP.Net

查看:73
本文介绍了如何在ASP.Net中以编辑模式获取图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用文件上传控件上传图像.我使用文件系统保存图像.图像保存在我的项目文件夹中,该图像路径存储在数据库中.
一切都很好.但是,我在这里遇到问题,即

在编辑模式下,如何在文件上传控件中获取文件路径

如果有人知道这一点,请帮助我.

致谢,
Nanda Kishore.CH

Hi,

I used file upload control for upload the image. i used file system for saving image. Image is saving in my project folder, that image path is stored in database.
All are working fine. but, i face problem here i.e,

In edit mode how to get the file path in fileupload control

If any one Know About this, Help me.

Regards,
Nanda Kishore.CH

推荐答案

尝试在文件上传控件中显示此路径:
Try this to show path in fileupload control:
myFileUpload.Attributes.Add("value", pathYouWantToShow);



不过,我有一个查询:
用户从本地桌面选择文件并上传到您的网站后,文件将保存在服务器上的某个文件夹中,并且服务器的此路径保存在DB中.完全没有考虑到用户本地桌面的所有路径(如果可以,那么可以,否则...).
在文件上传控件中显示路径有什么意义?它不是原始的本地路径,而是服务器路径.此外,您要公开服务器路径吗?


最后,文件上传控件即使在上传过程中也不会保留路径.一旦将页面发回,他们就太松散了,这是设计使然,目的是为了控制安全性.您也应该遵循相同的规则,并避免显示任何路径.



Though, I have a query:
Once a user selects a file from local desktop and upload on your website, file is saved in some folder on your server and this path of the server is saved in DB. Nowhere at all path of local desktop of the user is taken into account (if so then it''s ok or else...).
What''s the point of showing the path in fileupload control? It will not be the original local path but server path. Further, Do you want to expose your server path?


Last thing, file upload controls does not retain path even during uploads. Once page is posted back, they too loose it and this has been done by design to keeping security concerns in check. You too should follow the same and avoid showing any path.


这篇关于如何在ASP.Net中以编辑模式获取图像路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆