Posts

Showing posts from November, 2014

Upload Image to MySQL blob through Android

Image
For uploading an image to the MySQL database is really quite simple just you have to follow these simple code snippet. Android Case Get an image using the android you can do this by using startActivityForResult(intent,requestcode) Use this code onClick Method of the Button   Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);   photoPickerIntent.setType("image/*");   startActivityForResult(photoPickerIntent, 100); Then override this below method button in the activity         @Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent);   if(imageReturnedIntent!=null)   {    if(requestCode == 100){            Uri selectedImage = imageReturnedIntent.getData();            InputStream imageStream = null; try { imageStream = getContentResolver().openInputStream(selectedImage); } catch (FileNotFoundException e) {