1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    17
    Answers
    1
    Vote Rating
    0
    guglio is on a distinguished road

      0  

    Default Answered: Submit image through form panel

    Answered: Submit image through form panel


    Hi,
    I'm new to sencha framework, and I have one big problem with an app I'm working on.
    It's a simple app that let you take contact info, like name, surname, email, etc...and a photo of the business card.
    This app is meant to be installed into iphone / ipad of my company, for a fair, so I'm using phonegap to compile the app.
    Now I've figured out how to take photo from camera and put into an ext.img the imageData or imageURI , but I don't know how to submit that photo with the rest of the form fields.
    When submitting the form, the fields will be stored into mysql db and the image, named like <first name>_<last name>.jpg, into "business_card" folder.

    Any suggestion?

  2. Just post your form with Ajax and add the dataUrl of the image to it:

    Code:
    var jsonFile = {
    	// other form fields here
    	base64Image: image
    };
    
    
    Ext.Ajax.request({
    	url: '/UploadImage',
    	method: 'post',
    	params: jsonFile,
    	success: function (response, opts) {
    		//
    	}
    });
    Than on the server convert the base64 string to a file and save.

  3. #2
    Sencha User
    Join Date
    Nov 2012
    Location
    Netherlands
    Posts
    50
    Answers
    6
    Vote Rating
    1
    eastlander is on a distinguished road

      0  

    Default


    Just post your form with Ajax and add the dataUrl of the image to it:

    Code:
    var jsonFile = {
    	// other form fields here
    	base64Image: image
    };
    
    
    Ext.Ajax.request({
    	url: '/UploadImage',
    	method: 'post',
    	params: jsonFile,
    	success: function (response, opts) {
    		//
    	}
    });
    Than on the server convert the base64 string to a file and save.

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    17
    Answers
    1
    Vote Rating
    0
    guglio is on a distinguished road

      0  

    Default


    Thanks so much!!!

  5. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    17
    Answers
    1
    Vote Rating
    0
    guglio is on a distinguished road

      0  

    Default


    I think I've solve the problem with an escamotage, I set a hidden textfield with the value of the base64 image taken, and than, when I submit the form, I also submit the base64 image and than decode with a php file that validate and after validation, decode the image and save it.


    I only need the right hint

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