更新面板中的fileupload控件 [英] fileupload control in update panel

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

问题描述

嗨所有

在内容页面上,我有updatepanel.in updatepanel我正在使用3个fileupload controls.on按钮点击事件我在服务器端保存文件,即在我的项目中,我创建了一个文件夹myfiles.inmyfiles文件夹我保存所有d 3文件,同时我必须检索每个文件的完整路径。我可以这样做...我的代码是

hi all
on content page , i have updatepanel.in updatepanel i am using 3 fileupload controls.on button click event i am saving files on server side ie in my project , i created a folder "myfiles".in "myfiles" folder i am saving all d 3 files, at d same time i have to retrieve complete path of each of files.how can i do this...my code is

protected void btnSubmit_Click(object sender, EventArgs e)
{
   HttpFileCollection hfc = Request.Files;
   for (int i = 0; i < hfc.Count; i++)
   {
      HttpPostedFile hpf = hfc[i];
      if (hpf.ContentLength > 0)
      {
         hpf.SaveAs(Server.MapPath("myfiles") + "\\" + Path.GetFileName(hpf.FileName));
      }
   }   
}



i无法保存所有d文件n myfies文件夹....请帮我编码


i am unable to save all d files n myfies folder....pls help me ou in coding

推荐答案

我认为你的更新面板需要一个触发器。目标控件ID应该是上传文件的按钮。

I think you need a trigger for your update panel. The target control id should be the button that uploads the file.
<asp:UpdatePanel runat="server">
        <ContentTemplate>
//Your code in here with btnUploader
                   </ContentTemplate>
<Triggers>
    <asp:PostBackTrigger ControlID="btnUploader" />
</Triggers>
    </asp:UpdatePanel>


这篇关于CP的文章可能有所帮助:更新面板中的文件上传 [ ^ ]



注意:快速谷歌搜索在第一页上将此结果返回给我...
This article here on CP may help: File Upload in Update Panel[^]

NOTE: A quick google search returned me this result on the first page...


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

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