[CLOSED] FileUpload can't work....

  1. #1

    [CLOSED] FileUpload can't work....

    hi,
    I download ext.net Basic FileUpload sample
    the Browse button can't now work
    Do I miss some step???
    I don't change any code...

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void UploadClick(object sender, DirectEventArgs e)
        {
            string tpl = "Uploaded file: {0}<br/>Size: {1} bytes";
            
            if (this.FileUploadField1.HasFile)
            {
               X.Msg.Show(new MessageBoxConfig
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.INFO,
                    Title = "Success",
                    Message = string.Format(tpl, this.FileUploadField1.PostedFile.FileName, this.FileUploadField1.PostedFile.ContentLength)
                });
            }
            else
            {
               X.Msg.Show(new MessageBoxConfig
                {
                    Buttons = MessageBox.Button.OK,
                    Icon = MessageBox.Icon.ERROR,
                    Title = "Fail",
                    Message = "No file uploaded"
                });
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>FormPanel - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" type="text/css" />
        
        <style type="text/css">
            #fi-button-msg {
                border: 2px solid #ccc;
                padding: 5px 10px;
                background: #eee;
                margin: 5px;
                float: left;
            }
        </style>
        
        <script type="text/javascript">
            var showFile = function (fb, v) {
                if (v) {
                    var el = Ext.get('fi-button-msg');
                    el.update('<b>Selected:</b> ' + v);
    
                    if (!el.isVisible()) {
                        el.slideIn('t', {
                            duration: .2,
                            easing: 'easeIn',
                            callback: function () {
                                el.highlight();
                            }
                        });
                    } else {
                        el.highlight();
                    }
                }
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <h1>File Upload Field</h1>
    
            <h2>Basic FileUpload</h2>
            
            <p>A typical file upload field with Ext style.  Direct editing of the text field cannot be done in a 
                consistent, cross-browser way, so it is always read-only in this implementation.</p>
            
            <ext:FileUploadField ID="BasicField" runat="server" Width="400" Icon="Attach" />
            
            <ext:Button runat="server" Text="Get File Path">
                <Listeners>
                    <Click Handler="var v = #{BasicField}.getValue(); Ext.Msg.alert('Selected&nbsp;File', v && v != '' ? v : 'None');" />
                </Listeners>
            </ext:Button>
    
            <h2>Basic FileUpload (Button-only)</h2>
            
            <p>You can also render the file input as a button without the text field, with access to the field's value via the 
                standard <tt>TextField</tt> interface or by handling the <tt>FileSelected</tt> event (as in this example).</p>
                
            <ext:FileUploadField runat="server" ButtonOnly="true">
                <Listeners>
                    <Change Fn="showFile" />
                </Listeners>
            </ext:FileUploadField>
            
            <div id="fi-button-msg" style="display:none;"></div>
            <div class="x-clear"></div>
            
            <h2>Form Example</h2>
            
            <p>The FileUploadField can also be used in standard form layouts, with support for anchoring, validation (the
                field is required in this example), empty text, etc.</p>
                
            <ext:FormPanel 
                ID="BasicForm" 
                runat="server"
                Width="500"
                Frame="true"
                Title="File Upload Form"
                AutoHeight="true"
                PaddingSummary="10px 10px 0 10px"
                LabelWidth="50">                
                <Defaults>
                    <ext:Parameter Name="anchor" Value="95%" Mode="Value" />
                    <ext:Parameter Name="allowBlank" Value="false" Mode="Raw" />
                    <ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
                </Defaults>
                <Items>
                    <ext:TextField ID="PhotoName" runat="server" FieldLabel="Name" />
                    <ext:FileUploadField 
                        ID="FileUploadField1" 
                        runat="server" 
                        EmptyText="Select an image"
                        FieldLabel="Photo"
                        ButtonText=""
                        Icon="ImageAdd"
                        />
                </Items>
                <Listeners>
                    <ValidityChange Handler="#{SaveButton}.setDisabled(!valid);" />
                </Listeners>
                <Buttons>
                    <ext:Button ID="SaveButton" runat="server" Text="Save" Disabled="true">
                        <DirectEvents>
                            <Click 
                                OnEvent="UploadClick"
                                Before="if (!#{BasicForm}.getForm().isValid()) { return false; } 
                                    Ext.Msg.wait('Uploading your photo...', 'Uploading');"
                                    
                                Failure="Ext.Msg.show({ 
                                    title   : 'Error', 
                                    msg     : 'Error during uploading', 
                                    minWidth: 200, 
                                    modal   : true, 
                                    icon    : Ext.Msg.ERROR, 
                                    buttons : Ext.Msg.OK 
                                });">
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:Button runat="server" Text="Reset">
                        <Listeners>
                            <Click Handler="#{BasicForm}.getForm().reset();" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </form>
    </body>
    </html>
  2. #2
    Hi,

    What version do you use?
    Please use latest code from svn
    http://svn.ext.net/premium/branches/2.0
  3. #3
    How can I use latest code from svn?
    I create a new site,
    use Package manager console to install-package Ex.net -pre
    I don't know how to use latest code

    Quote Originally Posted by Vladimir View Post
    Hi,

    What version do you use?
    Please use latest code from svn
    http://svn.ext.net/premium/branches/2.0
  4. #4
    1. Use any svn client (for example, TortoiseSVN) and download code from remote repository (see the url above) using own svn credentials
    2. Open solution in VS2010 and rebuild assemblies
    3. Use new assemblies in your project
  5. #5
    I rebuild assemblies, it's can work
    but my old project was used old assembilies
    I try update the bin folder, but it's can work
    please give me a suggestion,how to change old project dll ???

    Quote Originally Posted by Vladimir View Post
    1. Use any svn client (for example, TortoiseSVN) and download code from remote repository (see the url above) using own svn credentials
    2. Open solution in VS2010 and rebuild assemblies
    3. Use new assemblies in your project
  6. #6
    I try update the bin folder, but it's can work
    You should not directly deal with the "bin" folder.

    There is the "References" in the Project. You can see that in Solution Explorer.

    Remove the old Ext.NET.dll and add the new one.
  7. #7
    It's show can't not find namespace StoreRefreshDataEventArgs.
    how to solve it????

    Quote Originally Posted by Daniil View Post
    You should not directly deal with the "bin" folder.

    There is the "References" in the Project. You can see that in Solution Explorer.

    Remove the old Ext.NET.dll and add the new one.
  8. #8
    It was renamed to 'StoreReadDataEventArgs'
    Please see
    https://examples2.ext.net/#/GridPane..._Sorting/Page/
  9. #9
    It's work, thank you


    Quote Originally Posted by Vladimir View Post
    It was renamed to 'StoreReadDataEventArgs'
    Please see
    https://examples2.ext.net/#/GridPane..._Sorting/Page/

Similar Threads

  1. [CLOSED] [MVC] FileUpload in MVC
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2015, 4:03 PM
  2. [CLOSED] [#92] FileUpload
    By Timothy in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: Jan 16, 2013, 3:44 AM
  3. [CLOSED] Please help me with a fileupload question
    By vali1993 in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 15, 2012, 6:41 AM
  4. bug in fileupload
    By pablisho in forum 1.x Help
    Replies: 0
    Last Post: Jul 01, 2009, 10:55 AM
  5. Replies: 2
    Last Post: Mar 16, 2009, 1:50 PM

Posting Permissions