在asp.net中使用文件上传控件时,如何获取所选文件的完整路径 [英] How do I get full path of the selected file while using file upload control in asp.net

查看:55
本文介绍了在asp.net中使用文件上传控件时,如何获取所选文件的完整路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的要求是这样的 -

用户将在他的机器中选择excel文件。

我需要将excel表中的整个数据复制到数据库。

为此,我使用了文件上传控件来浏览excel。

但是我m只获取文件名而不是完整路径。

那么我将如何获得完整路径。

Hi All,

My requirement is like this-
User will select excel file in his machine.
I need to copy whole data present in that excel sheet to the database.
For this I have used File upload control to browse the excel.
But I'm getting only the file name not the full path.
So how will I get the Full path.

推荐答案

不可能。出于安全原因,浏览器不允许这样做

QnA 1 [ ^ ]

QnA 2 [ ^ ]
No it is not possible. For security reasons browsers do no allow this
QnA 1[^]
QnA 2[^]


创建一个OpenFileDialogBox实例,它将提示一个对话框供您选择文件,并且可以在OpenFileDialogBox属性中获取其完整路径。
create an instance of OpenFileDialogBox,it will prompt a dialog box for you to select your files and you can get its full path in OpenFileDialogBox properties.


这篇关于在asp.net中使用文件上传控件时,如何获取所选文件的完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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