[CLOSED] multiple file upload and file size at client side

Page 3 of 3 FirstFirst 123
  1. #21
    I only wanted to add that calling <formpanel>.getForm().reset() will bust the multiple attribute and it has to be set again for this to work, i.e. to be able to select multiple files.

    I wonder why the input file element can't be rendered with the multiple attribute assigned to begin with.
  2. #22
    I only wanted to add that calling <formpanel>.getForm().reset() will bust the multiple attribute and it has to be set again for this to work, i.e. to be able to select multiple files.
    A .reset() call should not affect on the multiple attribute and I cannot reproduce it with the test case below.

    Example
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:FormPanel ID="FormPanel1" runat="server" Width="500">
                <Items>
                    <ext:FileUploadField runat="server" AnchorHorizontal="100%">
                        <Listeners>
                            <Render Handler="this.fileInput.set({ multiple : 'multiple' });" />
                        </Listeners>
                    </ext:FileUploadField>
                </Items>
            </ext:FormPanel>
    
            <ext:Button runat="server" Text="Reset" Handler="function() { FormPanel1.getForm().reset(); }" />
        </form>
    </body>
    </html>
    I wonder why the input file element can't be rendered with the multiple attribute assigned to begin with.
    Unfortunately, the FileButton's template doesn't support any custom attributes to be applied.
    http://docs.sencha.com/extjs/4.2.1/s...eld-FileButton

    There is the following piece of template for the file input.
    '<input id="{id}-fileInputEl" class="{childElCls} {inputCls}" type="file" size="1" name="{inputName}">'
    Last edited by Daniil; Dec 15, 2014 at 5:32 AM.
  3. #23
    Hi, Daniil:

    Just to make sure, what version of Ext.Net do you use?

    I tested in 2.5.x and when I run your sample (in Chrome) I get this:

    Uncaught TypeError: Cannot read property 'set' of undefined

    in the render handler.

    I also noticed that you used this.fileInput while in 2.5.x I used:

            var SetMultipleUpload = function (fileupload) {
              fileupload.button.fileInputEl.set({ multiple: 'multiple' });
            }
    Last edited by bogc; Dec 12, 2014 at 10:31 PM.
  4. #24
    Daniil,

    Can you please take a look at my question in post #20 of this thread? (the last one in page 2).

    Thanks!

    Andrew
  5. #25
    @bogc, I tested with v1 as the thread is on the 1.x forum:) I didn't remember in time that you are on v2 currently.

    Reproduced with v2. I see that a file input is recreated on reset.

    I can suggest this override. Also there is no need in a Render handler with this override.
    Ext.form.field.FileButton.override({
        createFileInput : function(isTemporary) {
            var me = this;
    
            me.fileInputEl = me.el.createChild({
                name: me.inputName,
                id: !isTemporary ? me.id + '-fileInputEl' : undefined,
                cls: me.inputCls,
                tag: 'input',
                type: 'file',
                size: 1,
                multiple: "multiple" // added
            });
    
            me.fileInputEl.on('change', me.fireChange, me);  
        }
    });
    @ALobpreis, I afraid there is no such a possibility. At least, I am not aware of any.
Page 3 of 3 FirstFirst 123

Similar Threads

  1. [CLOSED] How to identify upload file size before uploading in IE?
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 29, 2012, 5:54 PM
  2. Replies: 2
    Last Post: Jan 17, 2012, 8:58 AM
  3. [CLOSED] Validate file size using FileUpload in client side
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 28, 2011, 4:12 PM
  4. Replies: 1
    Last Post: Jun 23, 2011, 9:37 AM
  5. Maximum file size for upload
    By CoolNoob in forum 1.x Help
    Replies: 3
    Last Post: Jan 07, 2010, 3:57 PM

Tags for this Thread

Posting Permissions