如何在asp.net中访问FileUpload的文本框内容 [英] How to access TextBox Content of FileUpload in asp.net
问题描述
朋友,
我不知道如何在asp.net中获取上传文件的完整路径
我已经尝试过FileUpload1.PostedFile.FileName以及< input> . .对于IE,它工作正常,但由于安全原因,对Mozilla和chrome不起作用.那么我如何获取文件的完整路径?请帮我
Hi Friends,
I dono how to get the full path of the uploaded file in asp.net
i ve tried FileUpload1.PostedFile.FileName and also <input> . . It works fine for IE but doesnt works for Mozilla and chrome due to Security reasons.. Then how can i get the Full path of the file? pleas help me
推荐答案
您应该知道您的应用程序在哪里保存文件,如果这样很容易获得完整的路径名,
Hi,
You should know where your application is saving files, if so getting full path name is easy,
String filename=fileup1.PostedFile.FileName;
这实际上返回了客户端文件名.表示指定文件的路径.
假设您的应用将所有文件保存在服务器的C:\ UPLOADED_FILES \下.
那么完整的文件名将是
this actually returns the client filename. Meaning the path to the specified file.
Supposed your app save all files under C:\UPLOADED_FILES\ in server.
then full file name will be
String filename="C:\UPLOADED_FILES\"+fileup1.PostedFile.FileName;
所以您现在拥有完整的路径.
so you have the full path now.
这篇关于如何在asp.net中访问FileUpload的文本框内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!