从文件上载控件获取完整的文件路径
嗨
我正在使用asp文件上传控件。
我想从控件中读取完整的文件路径
但是iam无法读取fileupload控件中的值。
我正在设置一个空值。
以下是控件和代码
< asp:FileUpload ID =FileNameControlrunat =server/>
this.PurchReqCatalogItemsDS.GetDataSet()。DataSetRun.AxaptaObjectAdapter.Call(WMDAddItemsFromExcelMethodName, FileNameControl.filename.ToString())
其实我是在Microsoft Dynamics Axapta 2012中将其用于企业门户
i从此获取空值
i尝试了方法FileNameControl.PostedFile.FileName。 ToString();
但是如果我使用这个iam得到对象引用未设置为实例错误
任何人都可以帮助如果我错过任何东西我就在这里
谢谢
Gangadhar
Hi
I am using a asp fileupload control.
I want to read the full file path from the control
But iam unable to read the value from the fileupload control.
I am geting a empty value.
Following is the control and code
<asp:FileUpload ID="FileNameControl" runat="server" />
this.PurchReqCatalogItemsDS.GetDataSet().DataSetRun.AxaptaObjectAdapter.Call(WMDAddItemsFromExcelMethodName, FileNameControl.filename.ToString())
Actually i am using this for enterprise portal in Microsoft Dynamics Axapta 2012
i am getting a empty value from this
i have tried method FileNameControl.PostedFile.FileName.ToString();
But if i am using this iam getting "object reference not set to an instance" error
Can any one help me in this if iam missing anything
Thanks
Gangadhar
你想在哪一方获得完整路径?服务器端还是客户端?在客户端,你无法获得完整的路径。在服务器端,您可以尝试以下代码:
Server.MapPath(FileUpload1.FileName);
Which side you want to get the full path? Server side or client side? In client side you cant get the full path. In server side you can try this code:
Server.MapPath(FileUpload1.FileName);
请参阅此 -
http://forums.asp.net/t/1077850.aspx/1 [ ^ ]
Refer this-
http://forums.asp.net/t/1077850.aspx/1[^]
>
您好b $ b感谢您的解决方案
我已将文件上传控件保留在更新面板中并且工作正常
有没有人有任何示例代码来读取从文件上传控件中获取的excel文件?
提前感谢
Hi Thanks for your solutions
I have kept the fileupload control inside a update panel and it worked
does anyone have any sample code to read a excel file which is taken from the file upload control ?
thanks in advance