Fileuploadfield in one click - htmlfile access is denied error

  1. #1

    Fileuploadfield in one click - htmlfile access is denied error

    Hello - I am relatively new to EXT.NET. I want to have only one image button. By clicking that user should first be prompted to select file. Once done, the file should get posted to server. I have reused most code from examples on ext.net.

    This compiles well but gives error "htmlfile: access is denied at runtime." Can some one help resolve? (Many buttons below are hidden)

    (Further trial/error reveals that Its the FileUploadField1.fileInput.dom.click() which is causing problem. If I make fileuploadfield visible and use browse button to select file, it works smooth. But If I use the image button, it causes access problem later when file is posted")

    <ext:FileUploadField hidden="true" ID="FileUploadField1" runat="server" ButtonOnly="true" />
                                        <ext:ImageButton ID="SaveButton"  runat="server" ImageUrl="./Images/Upload.jpg"  >
                                            <Listeners>
                                                <Click Handler="FileUploadField1.fileInput.dom.click();#{HiddButt}.fireEvent('click');" />
                                            </Listeners>
                                        </ext:ImageButton>
                                        <ext:Button ID="HiddButt" runat="server" hidden="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>
    Here is the vb script for server side
    <script runat="server">
        Protected Sub UploadClick(sender As Object, e As DirectEventArgs)
            Dim tpl As String = "Uploaded file: {0}<br/>Size: {1} bytes"
            
            If Me.FileUploadField1.HasFile Then
                ImageButton1_Click(sender)
                Ext.Net.X.Msg.Show(New MessageBoxConfig() With { _
                 .Buttons = MessageBox.Button.OK, _
                 .Icon = MessageBox.Icon.INFO, _
                 .Title = "Success", _
                 .Message = String.Format(tpl, Me.FileUploadField1.PostedFile.FileName, Me.FileUploadField1.PostedFile.ContentLength) _
                })
            Else
                Ext.Net.X.Msg.Show(New MessageBoxConfig() With { _
                 .Buttons = MessageBox.Button.OK, _
                 .Icon = MessageBox.Icon.[ERROR], _
                 .Title = "Fail", _
                 .Message = "No file uploaded" _
                })
            End If
        End Sub
    Last edited by Daniil; Aug 08, 2011 at 6:03 PM. Reason: Please use [CODE] tags
  2. #2
    The thread is related to:
    http://forums.ext.net/showthread.php?14940

Similar Threads

  1. [CLOSED] Urgent: Permission denied Error
    By webppl in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Jan 12, 2012, 4:10 PM
  2. [CLOSED] WebPart and access denied to web.config
    By krzak in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 14, 2011, 11:54 AM
  3. Replies: 0
    Last Post: Oct 30, 2009, 3:57 AM
  4. Replies: 3
    Last Post: Aug 13, 2009, 2:38 PM
  5. [CLOSED] htmlFile: Access Denied
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 27, 2009, 11:40 AM

Posting Permissions