将图像保存在子目录中 [英] save Image in sub Directory

查看:68
本文介绍了将图像保存在子目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过子目录或子文件夹中的文件上传控件保存图像。但是我得到一个例外来



'E:\ 23 -3-2013 ABC\Carkhojo\photos\Ford\FiestaAudi Q7 3.0 TDI quattro\Audi Q7 3.0 TDI quattro.jpg'



不是有效的虚拟路径。

解决方案

这对你有帮助







 Server.MapPath( )返回当前物理目录 正在执行的文件(例如aspx)
Server.MapPath( ..)返回父目录
Server.MapPath( < span class =code-string>〜)返回物理路径 应用程序
Server.MapPath( /)返回物理路径 域名( 必须与相同 / pre>

I am try to save Image through File Upload control in a sub directory or sub Folder.But I am getting a exception to

'E:\23-3-2013 ABC\Carkhojo\photos\Ford\FiestaAudi Q7 3.0 TDI quattro\Audi Q7 3.0 TDI quattro.jpg'

is not a valid virtual path.

解决方案

this will be Helpful for you



Server.MapPath(".") returns the current physical directory of the file (e.g. aspx) being executed
Server.MapPath("..") returns the parent directory
Server.MapPath("~") returns the physical path to the root of the application
Server.MapPath("/") returns the physical path to the root of the domain name (is not necessarily the same as the root of the application)


这篇关于将图像保存在子目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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