Results 1 to 6 of 6

Thread: how to get file uploaded from editor grid as a file object?

  1. #1

    Default how to get file uploaded from editor grid as a file object?

    Hi

    I have created a grid having editor plugin, I have a column in the grid for file upload, I am using fileuploadfield for this purpose. This allows me to select a file.


    //Here are the various components associatedwith the grid- file upload

    //editor file field
    Code:
    var sFile = {
                                        fileUpload:true,
                                        xtype:'fileuploadfield',
                                         name:'sFile'
                            };


    //Column Model of the grid
    Code:
    var cm = new Ext.grid.ColumnModel({
                                        
                                        columns: [  new Ext.grid.RowNumberer(),{
                                        id:'sFile',
                                        header: 'File',
                                        dataIndex: 'sFile',  
                                        width: 200,                                         
                                        editor: sFile
                                        }]
                            });



    // create the editor grid
    Code:
            this.cgrid= new Ext.grid.GridPanel({
            store: that.store,
            cm: cm,
            editable: true,
            height: 200,
            plugins: [editor],
           clicksToEdit: 1,
           enableColumnMove:false,
    
       });
    However when I try to access the file object,it is a String containing the path of the file, something like(C:\fakepath\.eprod)

    How can I get a file object?? Should I provide a type in the jsonStore?
    // This is how I am accessing the items inthe grid
    Code:
    var itemsInStore = that.cgrid.store.data.items;
    form.submit({
                            url: '/Test/App/addFile.do',
                            params: {
                                        sFile:itemData.sFile,
                             },
                            success: function(form, action) {
                                        Ext.Msg.alert('Success');
                            },
                            failure: function(form, action) { ;
                                        Ext.Msg.alert('Failed');
                            }
                });
    Code:
    var itemData = itemsInStore[i].data;
    //This is the value in the itemData variable
    Code:
    Object { sFile:"C:\fakepath\.eprod"}
    I am stuck with this issue.Any suggestions would help


    Thanks in advance

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    I'm not sure if a fileupload field can be an editor in a grid because it utilizes a hidden iframe. You can find more information in the File Uploads section of this doc page:
    http://docs.sencha.com/extjs/3.4.0/#...form.BasicForm

  3. #3

    Default

    Okay, Can I get the full upload path of the file..? That is like, C:\Desktop\Folder\FileToBeUploaded.xls instead of C:\fakepath\FileToBeUploaded.xls..?

  4. #4
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    I don't think browsers will give you the full path, as it would be a security problem.

  5. #5

    Default

    @Gary

    Thanks..
    Any Suggestions on how I will be able to proceed?
    Or any alternate way of achieving a file upload through grid..?

  6. #6
    Touch Premium Member
    Join Date
    Mar 2012
    Posts
    115

    Default

    This is an old thread but did you ever get it to work or find a workaround

Tags for this Thread

Posting Permissions

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