1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Default Ext.ux.UploadDialog not post the filename

    Ext.ux.UploadDialog not post the filename


    Hello,

    I am using the uploaddialog from Maxim Bazhenov

    PHP Code:
    this.dlg = new Ext.ux.UploadDialog.Dialog(null, {
                                
    autoCreatetrue,
                                
    closablefalse,
                                
    collapsiblefalse,
                                
    draggabletrue,
                                
    minWidth400,      
                                
    minHeight200,
                                
    modal:true,
                                
    width400,
                                
    height350,
                                
    proxyDragtrue,
                                
    resizablefalse,
                                
    constraintoviewporttrue,
                                
    title'Upload',
                                
    url'upload.php?reqaction=uploadfile&resptype=json',
                                
    reset_on_hidefalse,
                                
    allow_close_on_uploadtrue,
                                
    upload_autostartfalse,
                                
    permitted_extensions: ["txt"]
            }); 

    PHP Code:
    <?php

    $uploaddir 
    'files/';
    $uploadfile $uploaddir basename($_FILES['file']['name']);

    $response = array();
    if (
    move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    $response['success'] = true;
    $response['message'] = 'File uploaded successfully';
    }
    else {
    $response['success'] = false;
    $response['message'] = 'Some error occurred during file upload';
    }
    echo 
    json_encode($response);
    ?>

    I can show the upload dialog , browse to a file. But when i tried to access the $_FILES['file'], it gives me an error. I can see it in Firebug

    Can you check my code ?

    Do you have some examples ?


    thanks
    Olivier

  2. #2
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    495
    Vote Rating
    4
    MaximGB is on a distinguished road

      0  

    Default


    What error do you see in the Firebug exactly?
    Use the force - read the source.

  3. #3
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Default


    I can see in firebug that the uploaddialog is doing the request but no data in POST

    When i try to access $_FILES in php the array is empty.

    In firebug, i see that my php code is returning an error that the $_FILEs is not defined.

    THanks
    Olivier

  4. #4
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    495
    Vote Rating
    4
    MaximGB is on a distinguished road

      0  

    Default


    PHP Version?
    OS Version?
    Do you have file_uploads = On in php.ini?
    Do you have upload_tmp_dir set in php.ini?
    What permissions are set on upload directory?

    Also try to use base_params config option for sending query parameters like "reqaction=uploadfile&resptype=json"
    Use the force - read the source.

  5. #5
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Default


    I am using PHP 5.2.0

    The tmp dir is ok, i have a simple upload in HTML and it works

    using the base_params doesnt pass the parameters.

  6. #6
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Default


    Can you copy a simple syntax how to pass the params via base_params ?


    thanks
    Olivier

  7. #7
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    495
    Vote Rating
    4
    MaximGB is on a distinguished road

      0  

    Default


    Code:
    dialog = new Ext.ux.UploadDialog.Dialog(null, {
            autoCreate: true,
            closable: true,
            collapsible: false,
            draggable: true,
            minWidth: 400,      
            minHeight: 200,
            width: 400,
            height: 350,
            proxyDrag: true,
            resizable: true,
            constraintoviewport: true,
            title: 'File upload queue.',
            url: 'upload-dialog-request.php',
            reset_on_hide: false,
            allow_close_on_upload: true,
            upload_autostart: true,
            base_params: { reqaction: 'uploadfile', resptype: 'json' }
          });
    Also you can set base_params with setBaseParams() method.
    Use the force - read the source.

  8. #8
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Default


    I added the code but i still cannot see the params

    Can you send me again the URL with the latest code ?

    Just to make sure.

    thanks
    Olivier

  9. #9
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    495
    Vote Rating
    4
    MaximGB is on a distinguished road

      0  

    Default


    For ExtJS 1.x
    http://max-bazhenov.com/dev/upload-d...loadDialog.zip

    For ExtJS 2.x
    http://max-bazhenov.com/dev/upload-d...loadDialog.zip

    Can you give me a link to a page where you use the extension and ftp access? Then I can check both server side and client side code and point you where the error is..
    Use the force - read the source.

  10. #10
    Ext User
    Join Date
    Sep 2007
    Posts
    26
    Vote Rating
    0
    ocheneson is on a distinguished road

      0  

    Thumbs up


    Maxim,

    Now it is working. I was not returning the correct JSON string.

    Now it is ok and i can access $_FILES

    THanks for your help

    Olivier