1. #1
    Sencha User
    Join Date
    Oct 2010
    Location
    philippines
    Posts
    26
    Vote Rating
    0
    edwin.deloso is on a distinguished road

      0  

    Default ext js upload with multiple images at once.

    ext js upload with multiple images at once.


    hi Guys,

    Can anyone help me. I have a form that needs to upload two image at once. The problem was in the server side since the requirement of saving the images would be in separate folder.

    Below is my server side code, this works fine but when I change into different images target path it cause an error.


    move_uploaded_file($_FILES['img']['tmp_name'][0],$imgpath . $_FILES['img']['name'][0]);
    $listview = $_FILES['img']['name'][0];

    move_uploaded_file($_FILES['img']['tmp_name'][1],$imgpath . $_FILES['img']['name'][1]);
    $iconview = $_FILES['img']['name'][1];

    thanks for any help.
    I'm a web developer/software engineer and a business coach who helps those new to online marketing or who are in direct sales generate a steady flow of fabulous leads using on-line business tools. I love helping people generate more sales & income without having to experience rejection & frustration.

    http://edwindeloso.com

  2. #2
    Sencha User
    Join Date
    Oct 2010
    Location
    philippines
    Posts
    26
    Vote Rating
    0
    edwin.deloso is on a distinguished road

      0  

    Default preview image after uploading

    preview image after uploading


    Hi guys,

    This is my ext js script for the uploading.

    I have two problem.

    1. How can I preview the image after uploading is done before saving the image filename to the db.
    As you can see , I have this:
    autoEl:{
    tag:'div', children: [{
    tag:'img',
    src: listview + medium,
    width : 59,
    height : 60
    },
    -- > the SRC tag will just display the image once the form is loaded.

    2. Images are successfully move to my desired folder but my page will return an error.. it says missing xml...

    Thanks for any help.


    function pmuploadUtilityWindow(id, module, medium,small,sg){
    var frmUpload = new Ext.FormPanel({
    autoHeight: true,
    baseCls: 'x-plain',
    fileUpload: true,
    bodyStyle: 'padding: 10px 0px 10px 10px;',
    labelWidth: 100,
    defaultType: 'fileuploadfield',
    defaults: {
    anchor: '98%',
    allowBlank: true,
    msgTarget: 'side'
    },
    items:
    [{
    xtype:'box',
    anchor:'',
    fieldLabel:'List View ',
    autoEl:{
    tag:'div', children: [{
    tag:'img',
    src: listview + small,
    width : 32,
    height : 33
    },
    {
    tag:'div',
    style:'margin:0 0 4px 0'
    }]
    }
    },
    {
    xtype : 'fileuploadfield',
    buttonText: 'Browse',
    fieldLabel: 'list view',
    emptyText: small,
    autoHeight:true,
    name: 'img[]',
    id: 'listview'
    },
    {
    xtype:'box',
    anchor:'',
    fieldLabel:'Icon View ',
    autoEl:{
    tag:'div', children: [{
    tag:'img',
    src: listview + medium,
    width : 59,
    height : 60
    },
    {
    tag:'div',
    style:'margin:0 0 4px 0'
    }]
    }
    },
    {
    xtype : 'fileuploadfield',
    buttonText: 'Browse',
    fieldLabel: 'icon view',
    emptyText: medium,
    autoHeight:true,
    name: 'img[]',
    id: 'iconview'
    },
    {
    xtype: 'fieldset',
    items: [{
    xtype: 'checkbox',
    fieldLabel: 'Secure to guest', renderer:toCheckBox,
    name : 'securetoguest',
    checked : sg,
    id: 'securetoguest'
    }]
    }
    ],
    buttons: [{
    text: 'Upload',
    handler: function(){
    if(frmUpload.getForm().isValid()){
    frmUpload.getForm().submit({
    url: 'server/Uploader.php',
    params : {
    func: "1003",
    propertyId: PROPERTY_ID,
    Id: id,
    module: module

    },
    method: 'POST',
    enctype: 'multipart/form-data',
    waitMsg: 'Uploading your image...',

    success: function(){
    dialog.showInfo('Uploading', 'uploading images done.');
    pmuploadWindow.close();
    PropListStore.loadData();
    },
    failure: function(){
    dialog.showError(PropertyModuleErrorTitle, PropertyModuleErrorMsg);
    }
    });
    }
    }
    },{
    text: 'Cancel',
    handler: function(){
    frmUpload.getForm().reset();
    pmuploadWindow.close();
    }
    }]
    });
    I'm a web developer/software engineer and a business coach who helps those new to online marketing or who are in direct sales generate a steady flow of fabulous leads using on-line business tools. I love helping people generate more sales & income without having to experience rejection & frustration.

    http://edwindeloso.com

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    1. What is your server returning from the file upload? (have another look at the BasicForm API docs for special requirements regarding file upload).

    2. The boxcomponent you use to display the image isn't a form field, so it won't be updated when the form loads. You will have to write an actioncomplete event handler to update the image src. Append an ?_dc=<time> parameter to the url for force reloading if the image url doesn't change.

  4. #4
    Sencha User
    Join Date
    Oct 2010
    Location
    philippines
    Posts
    26
    Vote Rating
    0
    edwin.deloso is on a distinguished road

      0  

    Default


    hi Condor,

    Thanks for your reply.

    1. Here is the return error :
    missing } in XML expression
    [IMG]chrome://firebug/content/blank.gif[/IMG]{"success":"true"})

    from this server side code:
    if($_FILES["img"][0]["error"] > 0){
    echo $_FILES["file"][0]["error"];
    } else {
    move_uploaded_file($_FILES['img']['tmp_name'][0],$imgpath1 . $_FILES['img']['name'][0]);
    $listview = $_FILES['img']['name'][0];
    }

    if($_FILES["img"][1]["error"] > 0){
    echo $_FILES["file"][1]["error"];
    } else {
    move_uploaded_file($_FILES['img']['tmp_name'][1],$imgpath2 . $_FILES['img']['name'][1]);
    $iconview = $_FILES['img']['name'][1];
    }
    saveuploadedImage_PropertyModules($propertyId,$Id,$iconview,$listview,$securetoguest);
    break;

    What I noticed is if I same folder target then it works fine.

    thanks,

    Edwin
    I'm a web developer/software engineer and a business coach who helps those new to online marketing or who are in direct sales generate a steady flow of fabulous leads using on-line business tools. I love helping people generate more sales & income without having to experience rejection & frustration.

    http://edwindeloso.com

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Your server is definitely returning the wrong information to the client. As I said, reread the BasicForm API docs.

Similar Threads

  1. Upload multiple images using javascript?
    By dolittle in forum Community Discussion
    Replies: 15
    Last Post: 24 Mar 2012, 4:18 AM
  2. How To Upload Images to the Server
    By gweberhart in forum Ext GWT: Discussion
    Replies: 9
    Last Post: 2 Sep 2010, 8:34 AM
  3. How To Upload Images to the Server
    By gweberhart in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 16 Jul 2010, 10:20 AM
  4. Upload file[images] using AJAX
    By sathtek in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 1 Sep 2007, 2:45 PM
  5. [wiki] How can I upload images?
    By Skeleton in forum Community Discussion
    Replies: 2
    Last Post: 1 Aug 2007, 12:22 PM

Thread Participants: 1

Tags for this Thread

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