HttpPostedFile.FileName 属性
定义
获取客户端上文件的完全限定名称。Gets the fully qualified name of the file on the client.
public:
property System::String ^ FileName { System::String ^ get(); };
public string FileName { get; }
member this.FileName : string
Public ReadOnly Property FileName As String
属性值
客户端的文件的名称,包含目录路径。The name of the client's file, including the directory path.
示例
下面的代码示例演示如何将) 文件集合中的第一个文件 (上传的文件的名称分配给 string 变量。The following code example demonstrates how to assign the name of an uploaded file (the first file in the file collection) to a string variable.
HttpFileCollection MyFileColl = Request.Files;
HttpPostedFile MyPostedFile = MyFileColl.Get(0);
String MyFileName = MyPostedFile.FileName;
Dim MyFileColl As HttpFileCollection = Request.Files
Dim MyPostedFile As HttpPostedFile = MyFileColl.Get(0)
Dim MyFileName As String = MyPostedFile.FileName