[CLOSED] how can i upload multiple files using Ext.NET + IE

Page 2 of 2 FirstFirst 12
  1. #11

    Online somewhere?

    I realize you have it in the trunk but is there anywhere online I can look at this new component without having to build it?
  2. #12
    Not yet. It will be available online with the next release.
  3. #13

    hot to upload the selected many files by codebehind code!

    hi:
    ext.net team! I hava impliment the selected many files by the javascript ,but i can't upload the flies which is selected by the javascript,please help me!
  4. #14
    Hi @hujq,

    We could look at a test case.
  5. #15

    my example

    Quote Originally Posted by Daniil View Post
    Hi @hujq,

    We could look at a test case.

    <%@ Page Language="C#" AutoEventWireup="true" %>
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void UploadClick(object sender, DirectEventArgs e)
        {
            if (Request.Files.Count > 0)
            {
                //Files received
    
    
                var filesReceivedAllKey = Request.Files.AllKeys;
                var filesReceived = Request.Files.Keys;
                if (FileUploadField1.HasFile)
                {
                    for (int i = 0; i < filesReceived.Count; i++)
                    {
                        string aa = filesReceivedAllKey[i];
                        string filePath = "~/UploadFile/" + i.ToString();
                        //((FileUploadField)FindControl(filesReceivedAllKey[i].ToString())).PostedFile.SaveAs(MapPath(filePath));
                        FileUploadField1.PostedFile.SaveAs(MapPath(filePath));
                       
                    }
                }
            }
        }
          
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <script type="text/javascript">
    
    
            var UpdateUploadInfo = function (el, label) {
    
    
                // debugger;
                var ret = true;
    
    
                if (Ext.isIE) {
                    return;
                }
                var size = 0;
                var names = '';
                for (var num1 = 0; num1 < el.files.length; num1++) {
                    var file = el.files[num1];
                    names += file.name + '\r\n';
                    //alert(file.name+" "+file.type+" "+file.size);
                    size += file.size;
                }
                var txt = '';
                var fileSize = Ext.util.Format.fileSize(size);
    
    
                if (size > 31457280) {
                    txt = Ext.String.format('You are trying to upload {0}. Max. allowed upload size is 30 MB', fileSize);
                    ret = false;
                } else {
                    txt = Ext.String.format('{0} file(s) of total size {1}', el.files.length, fileSize);
                }
    
    
                label.setText(txt);
                return ret;
            }
    
    
            var SetMultipleUpload = function (fileupload, label) {
                fileupload.fileInputEl.set({ multiple: 'multiple' });
    
    
                if (Ext.isIE) {
                    label.setText('IE does not support multiple file upload, to use this feature use Firefox or Chrome');
                }
            }
        </script>
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <form id="form1" runat="server">
        <ext:Window ID="MainWindow" runat="server" Height="260" Width="390" Layout="FitLayout"
            Collapsible="true" Title="Upload files">
            <Items>
                <ext:FormPanel ID="BasicForm" runat="server" Frame="true" MonitorValid="true" DefaultAnchor="100%">
                    <Items>
                        <ext:FileUploadField ID="FileUploadField1" runat="server" ButtonText="Add Files"
                            Icon="Add" ButtonOnly="true" AllowBlank="false">
                            <Listeners>
                                <Render Handler="SetMultipleUpload( this, #{UpdateLabel}) ;" />
                                <Change Handler="if(!UpdateUploadInfo(this.fileInputEl.dom, #{UpdateLabel})) {this.reset();SetMultipleUpload( this, #{UpdateLabel})}" />
                            </Listeners>
                        </ext:FileUploadField>
                        <ext:Label ID="UpdateLabel" runat="server">
                        </ext:Label>
                    </Items>
                    <Listeners>
                        <ValidityChange Handler="#{SaveButton}.setDisabled(!valid);" />
                    </Listeners>
                    <Buttons>
                        <ext:Button ID="SaveButton" runat="server" Text="Save">
                            <DirectEvents>
                                <Click OnEvent="UploadClick">
                                    <EventMask ShowMask="true" />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:Button ID="Button2" runat="server" Text="Reset">
                            <Listeners>
                                <Click Handler="#{BasicForm}.getForm().reset(); SetMultipleUpload( #{FileUploadField1}, #{UpdateLabel});#{UpdateLabel}.setText('');" />
                            </Listeners>
                        </ext:Button>
                    </Buttons>
                </ext:FormPanel>
            </Items>
            <Listeners>
                <Hide Handler="#{BasicForm}.getForm().reset(); SetMultipleUpload( #{FileUploadField1}, #{UpdateLabel});#{UpdateLabel}.setText('');" />
            </Listeners>
        </ext:Window>
        </form>
    </body>
    </html>
  6. #16
    I think you should get the files directly from Request.Files, not from a FileUploadFied.

    However, your example seems don't allow me to choose several files. When I pick up the second file it still says "1 file(s) ..." and actually uploads a single file.
  7. #17
    SwfUploader has been renamed to MultiUpload. So, it will appear in the v2.3 release as MultiUpload.
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] multiple file upload and file size at client side
    By mirwais in forum 1.x Legacy Premium Help
    Replies: 24
    Last Post: Dec 15, 2014, 5:44 AM
  2. [CLOSED] Multiple file support to upload in file upload control
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 01, 2013, 9:41 AM
  3. File Upload Field - Multiple files?
    By peter.campbell in forum 1.x Help
    Replies: 2
    Last Post: Jul 04, 2012, 11:40 AM
  4. [CLOSED] Upload files
    By Marcelo in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 20, 2012, 9:54 PM
  5. Replies: 1
    Last Post: Jun 23, 2011, 9:37 AM

Tags for this Thread

Posting Permissions