如何使文件上传与gmail包含相同(允许上传多个文件) [英] how to make fileupload same as gmail contain (allow more than one file to be uploaded)

查看:57
本文介绍了如何使文件上传与gmail包含相同(允许上传多个文件)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Helloo,

我想使用多个文件附件上传文件,然后将所有上传的文件作为附件发送给选定的用户.

但是如何使文件上传与gmail相同.

请给我一些帮助.

谢谢和问候...
Mitesh

解决方案

您正在寻找类似这样的东西:

 <   asp:fileupload     id   ="     runat   =" 服务器"  allowmultiple    true"  xmlns: asp   ="    / > 
<   asp:button     id   ="   runat   服务器" 文本  上传文件"  onclick   ="     ="  #unknown" /  受保护的 无效 uploadFile_Click(对象发​​件人,EventArgs e)
{
    如果(multipleFile.HasFiles)
    {
         foreach (HttpPostedFile uploadFile  in  multipleFile.PostedFiles)
        {
            uploadFile.SaveAs(System.IO.Path.Combine(Server.MapPath("  ),uploadedFile.FileName));
            Response.Write(" );
        }
    }
} 


Helloo,

I want to make file upload with the multiple file attachment and then i send all that uploaded file to the selected user as attachment.

but how to make file upload same as gmail have.

please give me some help in this metter.

Thanks and Regards...
Mitesh

解决方案

hi, you are looking for something like this:

<asp:fileupload id="multipleFile" runat="server" allowmultiple="true" xmlns:asp="#unknown" />
<asp:button id="uploadFile" runat="server" text="Upload files" onclick="uploadFile_Click" xmlns:asp="#unknown" />



protected void uploadFile_Click(object sender, EventArgs e)
{
    if (multipleFile.HasFiles)
    {
        foreach(HttpPostedFile uploadedFile in multipleFile.PostedFiles)
        {
            uploadedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"),uploadedFile.FileName));
            Response.Write("File uploaded successfully");
        }
    }
}


这篇关于如何使文件上传与gmail包含相同(允许上传多个文件)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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