fileupload有文件问题 [英] fileupload has file problem

查看:58
本文介绍了fileupload有文件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新面板问题与文件upload.but文件上传超出更新面板。文件上传文件始终为false。

update panel problem with file upload.but file upload out of update panel. file upload has file is always false.

推荐答案

这是因为Form的encType属性。

你需要设置
It is because of Form's encType attribute.
you need to set
encType = "multipart/form-data"





在您的控件的Init evet中尝试此代码。它会将encType属性添加到页面上的表单中,然后您可以在FileUpload Control中接收文件字节。





Try this code inside Init evet of your control. It will add the encType attribute to the form you have on your page and then you may receive file bytes inside FileUpload Control.

ScriptManager.RegisterStartupScript(page, page.GetType(), Guid.NewGuid().ToString() + new Random().ToString().Replace(".", ""), "


('#yourFormID')。attr('enctype','multipart / form-data');,< span class =code-keyword> true );
('#yourFormID').attr('enctype', 'multipart/form-data');", true);





注意:您需要在页面上引用JQuery或者使用javascript来完成这项工作。



祝你好运:)



Note: you need to have JQuery referenced onto your page or alternatively use javascript to do this job.

Good luck :)


我有同样的问题



文件上传在UpdatePanel中不起作用.........
I have Same Problem

File Upload Is not Working In UpdatePanel.........


这篇关于fileupload有文件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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