How to select and post an image from gallery

How to select and post an image from gallery

BY 08 Jul 2013 Web Application Development

Hi everyone,

I’m trying to make a form where I can select an image and post it. 

I found that : https://developer.tizen.org/forums/web-application-development/how-launch-gallery-app-and-retrieve-which-file-selected-0 ; to launch gallery and retrieve the selected image. 

Does anyone know how to get that image and post it ? I tried to look at FileReader but I need a File reference which come from the input type file. 

Thanks for your help

 

here is my code :

	var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick", null, "image/*");

	var appControlReplyCallback = {
	    onsuccess: function(data) {
	       for ( var i = 0; i < data.length; i++ ) {
	    	   if ( data[ i ].key == "http://tizen.org/appcontrol/data/selected" ) {
	    		   var path = data[ i ].value[ 0 ];
	    		   var itemPhoto = document.getElementById("selectedImage");
	    		   itemPhoto.setAttribute("src", path); // display image ok
	    		   // TODO : post image ...
	    	   }
	       }
	    },
	    onfailure: function() {
	       console.log('The launch application control failed');
	    }
	};

	tizen.application.launchAppControl(appControl, null,
		function() {console.log("launch application control succeed"); },
		function(e) {console.log("launch application control failed. reason: " + e.message); },
        appControlReplyCallback
	);

 

 

 

 

Written by