如何将输入的类型= QUOT;文件"到.NET文件上传?

问题描述:

我有一个使用标准形式现有的传统code。

I have existing legacy code that is using a standard form.

我想在后面抢code的句柄,这种输入类型=文件元素的页Init事件,并将其转换为一个.NET FileUpload对象。

I would like to in the page init event of the code behind grab a handle to this input type="file" element, and convert it to a .net fileUpload object.

这可能吗?而无需重写整个窗体?

Is this possible? Without rewriting the whole form?

先谢谢了。

编辑:不找如何处理上传处理,只是为了寻找切入点为例 - 怎么去输入类型=文件的引用,并把它作为一个.NET FileUpload对象。 - 再次感谢

Not looking for an example of how to handle the upload processing, just looking for the entry point - how to get a reference to the input type=file and treat it as a .net fileupload object. - Thanks again.

我的线沿线的思考

Dim myControl1 as FileUpload = FindControl("myFileElement")

这会工作,如果我能理清铸造问题?

Would this work if I could sort out the casting issue?

将在文件属性关闭的Htt prequest 类就够了?

Would the Files property off the HttpRequest class suffice?

的http:// MSDN。 microsoft.com/en-us/library/system.web.htt$p$pquest.files.aspx