使用文件上传控件上传图片 [英] upload picture with file upload control

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

问题描述

我有一个更新窗格;
在此更新面板中是面板
在此面板中是一个fileUpload和一个Button
我确实点击了文件上传并选择了一个文件,
当点击按钮时,返回"
在我的button_click中是以下代码:
button1.text = filaeupload1.filename;
为什么返回空值?


我的代码是这样的:
< asp:panel ....>

< asp:updatepanel ....>
< content template =">

< asp:fileupload ....>
< asp:button ... onclick ="clickonbutton">

br mode ="hold"/>

br mode ="hold"/>
在"clickonbutton"中是这样的代码:

button1.text = fileupload1.filename;

此代码始终返回null(")

当我从mproject中删除更新面板为true并且我的项目返回了所选文件的文件名


在最新的情况下,我只能选择jpg文件

i have a updatepane;
in this update panel is a panel
in this panel is a fileUpload and a Button
i do clicked on the fileupload and select a file,
and when click on the button return ""
in my button_click is this code:
button1.text= filaeupload1.filename;
why return null value?


my code is this:
<asp:panel ....>

<asp:updatepanel ....>
<content template="">

<asp:fileupload ....>
<asp:button ...onclick="clickonbutton">

br mode="hold" />

br mode="hold" />
and in "clickonbutton " is this code :

button1.text=fileupload1.filename;

this code always return null("")

when i do delete update panel from mproject is true and my project returned filename of selected file


in tha latest ,i want can only selectable jpg file

推荐答案




阅读您的评论后,我了解的是,您需要异步上传文件.您不能使用带有更新"面板的默认文件上传"来上传文件.您需要使用一些第三方控件进行异步文件上传.

阅读异步文件上传 [
Hi,


After reading your comments what i understand is, you need to upload file Asynchronously. you can not use default Fileuploaded with Update panel to upload file. you need to use some thirdparty control for Asynchronous file uploading.

Read Asynchronous File Upload[^] Article. this may help you,

Thanks
-Amit.


在脚本管理器上使用触发器:

use Trigger on Script Manager :

<asp:ScriptManager ID="sc1" runat="server">
         </asp:ScriptManager>
         <asp:UpdatePanel ID="u1" runat="server">
             <ContentTemplate>



//您的内容



// your content

</ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="Submit" />
                </Triggers>
            </asp:UpdatePanel>




在提交名称"中输入您的保存"或提交"按钮名称.

这将为您提供帮助.




in Submit name give your Save or Submit button name.

This will help you.


在脚本管理器上使用触发器:

use Trigger on Script Manager :

<asp:ScriptManager ID="sc1" runat="server">
         </asp:ScriptManager>
         <asp:UpdatePanel ID="u1" runat="server">
             <ContentTemplate>



//您的内容



// your content

</ContentTemplate>
                <Triggers>
                    <asp:PostBackTrigger ControlID="Submit" />
                </Triggers>
            </asp:UpdatePanel>




在提交名称"中输入您的保存"或提交"按钮名称.

这将为您提供帮助.




in Submit name give your Save or Submit button name.

This will help you.


这篇关于使用文件上传控件上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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