1. #1

    デフォルト Help - FileUpload - form.submit is not a function

    Help - FileUpload - form.submit is not a function


    I try to make a Upload Form using ajax request. My code :
    PHPコード:
    Ext.onReady(function() {
        
    ulDialogTest = new Ext.Window({
            
    layout:            'fit',
            
    height:            100,
            
    width:            500,
            
    title:            "Upload a Presentation",
            
    resizable:        true,
            
    bodyBorder:        false,
            
    buttons:        [{text"Upload"handlersubmitAjaxReq },
                             {
    text"Cancel"handler: function() {ulDialogTest.hide();}}],
            
    keys:            [{key27fn: function() {ulDialogTest.hide();}, scopethis}],
            
    items:            [
                
    ulFormTest = new Ext.form.FormPanel({
                    
    id'ulFormID',
                    
    labelAlign'right',
                    
    items: [{xtype:'textfield',inputType:'file',name:'Filedata',fieldLabel:'File'}]
                })
            ]
        });
        
    ulDialogTest.show();

        function 
    submitAjaxReq() 
        {
            
    //ulDialogTest.hide();
            
    Ext.Ajax.request({
               
    url'upload_example.php',
               
    params'',
               
    method"POST",
               
    form'ulFormID',
               
    timeout15000,
               
    waitMsg:'Executing Request...',
               
    isUploadtrue,
               
    headers: {'Content-type':'multipart/form-data'},
               
    successprocessSuccessResponse,
               
    failureprocessFailureResponse
            
    });
            
    //ulDialogTest.destroy();
            //ulFormTest.destroy();
        
    }

    function 
    processSuccessResponse(e){
        
    alert('success');
        
    alert(e.responseText);
    }

    function 
    processFailureResponse(e){
        
    alert('failure');
        
    alert(e.responseText);
    }
    }); 
    When run, i got this error :
    form.submit is not a function
    http://localhost/ext-2.1/ext-all-debug.js
    Line 5222
    Beside, file is not uploaded to the server.
    Thanks for help
    Sorry for my bad English.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    参加日付
    Apr 2007
    位置
    Sydney, Australia
    投稿数
    16,120
    Vote Rating
    508
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    デフォルト


    Why are you sending the form as an ajax request, why not just submit the form?

  3. #3

    デフォルト


    I'm in searching extjs. So i want to do this as a practice. I successed upload file with form submit. Can you help me resolve this. Thanks so much
    Sorry for my bad English.

  4. #4

    デフォルト


    I changed form: 'ulFormID' to form : ulFormTest.getForm().dom i got another problem
    POST http://localhost/30-5/upload_example.php500 (74ms)
    I think my php was wrong. Check this for me please
    PHPコード:
    <?php
        
    if (isset($_POST["PHPSESSID"])) {
            
    session_id($_POST["PHPSESSID"]);
        }
        
    session_start();

        if (!isset(
    $_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) {

            
    header("HTTP/1.1 500 File Upload Error");
            if (isset(
    $_FILES["Filedata"])) {
                echo 
    $_FILES["Filedata"]["error"];
            }
            exit(
    0);
        }
        
    $save_path getcwd() . "/uploads/";
        
    $file_name basename($_FILES["Filedata"]['name']);
        @
    move_uploaded_file($_FILES["Filedata"]["tmp_name"], $save_path.$file_name);
        
    $result = array("success" => true);
        echo 
    json_encode($result);
    ?>
    Sorry for my bad English.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar