输入文件中的图像完整路径 [英] image full path from input file

查看:83
本文介绍了输入文件中的图像完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


如何获取输入类型文件的完整路径(图片上传)..



因为当我上传图片,并签入.cs代码,我只获取图片名称而不是完整路径





请咨询



问候

maulik shah

解决方案

使用Server.MapPath获取完整路径。



请参考下文了解不同的使用方法。



http://www.aspnetcodes.com/2013/06/servermappath-in-c.html [ ^ ]


< blockquote>据我所知,您无法在客户端获取文件的完整路径。您可以获取服务器上的文件的完整路径,但不能像DriveName:\ FileName \ FileName那样。服务器上文件的路径类似于www.domain_name.com/folder_name/file_name。


您无法从服务器端获取完整路径。当您考虑它时,这是完全合理的,因为如果上传功能要揭示客户端文件夹结构的详细信息,它将代表一个主要的安全漏洞。如果您想要实现这种类型的效果,那么您需要编写自己的控件在客户端运行 - 如果您的应用程序仅在Windows上运行,您可以将其作为ClickOnce应用程序启动。然而,这是一种非常罕见的情况,您需要访问此级别的详细信息,


hi
how to get full path of input type file (image upload)..

because when i upload image , and check in .cs code , i get only name of image and not full path


pls advice

regards
maulik shah

解决方案

Use Server.MapPath to fetch the full path.

Refer below to know different ways of using it.

http://www.aspnetcodes.com/2013/06/servermappath-in-c.html[^]


As far as I know, you can not get the full path of a file on client side. You can get full path of a file which was on server but not like that "DriveName:\FolderName\FileName". Path of a file on server is like "www.domain_name.com/folder_name/file_name".


You cannot get the full path from the server side. When you think about it, this makes perfect sense as it would represent a major security vulnerability if the upload functionality were to reveal details about what the client side folder structures are. If you want to achieve this type of effect, then you need to write your own control that runs on the client side - if your app is running on Windows only, you could launch this as a ClickOnce app for instance. It's a very rare situation, however, where you need access to this level of detail,


这篇关于输入文件中的图像完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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