如何在asp.net中获取上载文件的地址 [英] how to get the address of the uploaded file in asp.net

查看:226
本文介绍了如何在asp.net中获取上载文件的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要我刚刚通过asp.net中的文件上传控件上传的文件的实际位置.我尝试使用

i need the actual location of the file that i have just uploaded via a file upload control in asp.net. i''ve tried using

string fileName = Path.GetFullPath(fUpldGetDoc.PostedFile.FileName);


但这会返回


but this returns

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\angel from montegomery.txt



但我需要文件的实际位置,即



but i need the actual location of the file i.e,

e:\angel from montegomery.txt

推荐答案

您可以使用javascript

http://forums.asp.net/t/1077850.aspx/1 [ ^ ]


还讨论了其他几种方法,希望对这些方法有用.
You can do by a javascript

http://forums.asp.net/t/1077850.aspx/1[^]


few other methods are also discussed and hope useful


使用System.io;

using System.io;

FileInfo f = New FileInfo(Server.MapPath(".") + "\" + uploadedfilename);

       String fileName = f.FullName;


string fileName = fUpldGetDoc.PostedFile.FileName;



试试这个



try this


这篇关于如何在asp.net中获取上载文件的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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