物理路径图像保存。 Asp.net [英] Physical Path for image saving. Asp.net
问题描述
我有一个web项目,我把我的图像保存在hdd的物理文件夹中像 d:\SecretImages\Imagename
。但是当我必须的时候我不能打开文件?
我想如果可以保存检查 d:\SecretImages\Temp.jpg
,我可以打开当我必须但是,我不能。
请帮助我,谢谢 解决方案
不能使用文件路径展示你的图片。浏览器不知道在哪里找到的图像,服务器不会因为安全问题而提供服务。
您可以/应该使用 HttpHandler 显示图像。
我回答了一个类似的问题在这里所以如何做到这一点。
I have a web project and I saved my images in Physical folders in hdd Like d:\SecretImages\Imagename
. But I can't open the files when I have to?
I thought if it can saves for examle d:\SecretImages\Temp.jpg
, I can open when I have to but, I can't.
Help me please, thanks
You cannot use file paths to show your images. The browser doesn't know where to find the images and the server wouldn't serve them up anyway due to security concerns.
You could/should use an HttpHandler to show the images.
I answered a similar question here on SO how to do this.
这篇关于物理路径图像保存。 Asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!