Results 1 to 3 of 3

Thread: Use problem with FileUploadField

  1. #1

    Default Use problem with FileUploadField

    Hello

    I try to use FileUploadFile.
    I can not get the variables on the file (in the debug console firefox): "tmp_name" "type" "size"
    Finally, I try to retrieve the path and extension.


    Here you will find the javascript code
    Code:
    function initFormAdminContent() {
        var btn_AdmindDGD_Submit = new Ext.Button({
            cls: 'x-btn100',
            text:'Mise  jour',
            handler:  function(){
                if(pan_Admin.getForm().isValid()){
                    pan_Admin.getForm().submit({
                        url: '../libs/php/file-upload.php',
                        waitMsg: 'Uploading your photo...',
                        success: function(pan_Admin, o){
                            Ext.Msg.show({title:'Success',msg: o.result.file.tmp_name+'Processed file "'+o.result.file.name+'" on the server', icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK});
                        }
                    });
                }
            }
        });
    
        var file_AdminDGD = new Ext.ux.form.FileUploadField({
            hideLabel: true,
            buttonOnly: true,
            id: 'file_AdminDGD',
            name: 'file_AdminDGD',
            buttonText: 'Parcourir',
            listeners: {
                'fileselected': function(fb, v){
                    var el = Ext.fly('file_AdminDGD_msg');
                    el.update('<b>Fichier :</b> '+v);
                    if(!el.isVisible()){
                        el.slideIn('t', {
                            duration: .2,
                            easing: 'easeIn',
                            callback: function(){
                                el.highlight();
                            }
                        });
                    }else{
                        el.highlight();
                    }
                }
            }
        });
    
    var pan_Admin = new Ext.FormPanel({
            title: 'Administration',
            fileUpload: true,
            frame: true,
            items:[{
                layout: 'column',
                border: false,
                items:[{
                    columnWidth:.5,
                    layout: 'form',
                    border:false,
                    items: [file_AdminDGD]
                },{
                    columnWidth:.5,
                    layout: 'form',
                    border:false,
                    items: [btn_AdmindDGD_Submit]
                }]
            },{
                html:"<div id=\"file_AdminDGD_msg\" style=\"display:none;\"></div>"
            }]
        });
        
        return pan_Admin;
    };
    Here you will find the php code
    Code:
    <?php
             sleep(1);
             echo '{success:true, file:'.json_encode($_FILES['file_AdminDGD']).'}';
    ?>

    Thank you for your help.
    excuse me for my english
    Attached Images Attached Images

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You can get the filename by calling fileUploadField.getValue() (also returned by the fileselected event).

    Due to security restrictions it's not possible to get the path or the content of the file.

  3. #3

    Default

    thank you for your information, this helped me a lot. I managed to run this function. Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •