Best Android Studio Tutorial on How to Upload Image/File to Server (Part 1)
Articles,  Blog

Best Android Studio Tutorial on How to Upload Image/File to Server (Part 1)


  • Hagar Hossam

    Thanks for this great tutorial,
    I just have a small issue when i capture a photo it automatically rotates 90 degrees and I don't want it to be rotated
    Thanks in advance.

  • SG Mishra

    Thanks for such a nice tutorial.but I'm doing everything like in your
    video.(Downloaded a library and pasted it. I write all code But no
    matter what it shows "Unfortunately your program has stopped" someyhing like this. Do you have any ideas why it do so?
    Thank you

  • Ala'a Assaf

    if you may kindly advise me, I am having a null pointer error whenever I am trying to getPhotoPath to display image taken by camera(photopath in bitmap code), though it worked well with uploading from gallery

  • privateelpro

    Teacher i got this work in android JellyBean 4.1 but when i try in Android Marshmallow 6.0, the app crashed. The error says "open failed: EACCESS (Permission denied)" when i try to open the camera, and otherwise the gallery let me choose a picture but then crashed before show me the picture chosen in the app. Could you help me with this? Thank you.

  • Trieu Tran

    Hi, I just want to say thank you as your videos have been helping me tremendously . I really appreciate it. Could you make a tutorial on how to use a *.gif file as a background in Android Studio ? That would be amazing. Thank you so much!

  • Arslan Ali Awan

    ThankYou so much , this video helped me alot But do you have tutorial to retrieve a image from server ? and thanks once again..

  • Arslan Ali Awan

    Hello sir , sir i am using your library genric aysnch 2 in uploading data to server BUT BY DEFAULT in your library progress dialog has a message 'loading' but i want to show 'uploading'. Please tell me how can i change it ??? i cant edit the loading message in your library , How can i change it ?

  • Artemis Roussos

    Can you make a project, a photo gallery that each time when I take a photograph from my android device it presents for each new photo the locality where I am at that time, the temperature of environment, the humidity, the atmospheric pressure, the barometer, the date that was pulled and the brightness. All these elements and photos they are stored in SQLite Database. Thank you in advance!


    sir,i want to make an app which could detect some particular shapes in the live camera feed. i m using opencv but i am not being able to get the proper algo or code for it.would you plz help me in doing this..

  • encoding _

    the api 6.0 not found permission generate errors Caused by: java.lang.SecurityException: Permission Denial: reading uri content://media/external/images/media/36
    whats its solutions? thanks

  • lyrificaton

    Hi Sir, sorry to interrupt you because I still cannot solve the problem of always having the "empty images" being generated and stored in the gallery, even though I decided not to take an image and exit the camera screen? Is there a way to eliminate this "blank image" problem?

    Another problem is that why sometime there is sudden enlarge of the picture that awkwardly cover the entire preview screen on the main page after taking a image? Is there a problem to solve it too? Thanks for the help!

  • Andreas Sentosa

    thank you so much for the tutorial. I have some question here,
    i have try it in real device (XIAOMI Redmi 2) but when i take some picture the application force close by it self, any idea to solve this problem ?
    Thank you for the nice tutorial

  • Shola Joseph Akinrolie

    Awesome video, pls can you extend this video to a count upload ….something similar to instagram app, where user's pics upload displays respectively below the ealier one …as many as it could be and it displays on the Home page respectively….thanks.


    Api 25 can't run. error permission generate errors Caused by: java.lang.SecurityException: Permission Denial: reading

  • Nicolás Bustamante

    hi Oum! Nice video y thank you so much. I relized the subtitles that you add, stopped apearing. Please can you fix it? The automatized subs are a crap. My english is very bad. Thank you again

  • Chirag Patel

    not working for me gallery intent im trying did everything ok just one difference im using fragment for it and u activity , wht s wrong? not loading image in imageview

  • Sjors van Dam

    I used your code to see if it works for me, but when installed on my device, when I click camera icon, it says "Something wrong while tkaing photos", when I use the gallery icon I can select a picture, but when clicking on a phot in gallery, the app crashes. I'm using android 7.0 on nexus 5x

  • Tony Mathew

    Hi this code is working fine in pre Naougat devices. When I tried it on Nougat, the app crashed and I got the error :
    exposed beyond app through ClipData.Item.getUri()
    Please fix this.

  • Em Pain

    E/EGL_emulation: tid 4156: eglSurfaceAttrib(1165): error 0x3009 (EGL_BAD_MATCH)
    W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xaa3b5f80, error=EGL_BAD_MATCH
    V/RenderScript: 0xa1f3d000 Launching thread(s), CPUs 2
    E/Surface: getSlotFromBufferLocked: unknown buffer: 0xa21ec620

  • Kishan Patel

    Hello all of you
    I got the solution for this please contact me on my skype :- kishanp9091

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    java.lang.SecurityException: Permission Denial: reading uri content://media/external/images/media from pid=12204, uid=10165 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

    not read and write image data in platform version 6.0.1 or api level 23 and upper

  • Mony Prak

    លោកគ្រួ តើធ្វើម៉េច ​អាចបង្កើត ប៊ូតុង ដោនលោត វិដេអូ បាន នៅក្នុង android studio

  • Johreen Arañas

    Hello Sir. The camera is working well thank you very much 🙂
    However, I can't get to display the picture from the Gallery. The app crashes when I try to select a picture from the Gallery. I use my phone for testing it. Its running on API 23 (6.0.1)

  • Davin Butler

    Is there a way to make this app compatible with newer versions of android studio? I'm running 25.1.1 and have just gone through most of the video without reading that your lib is only compatible with older versions and now I feel like I've wasted my time completely

  • Sriram Appusamy

    sir, after installing in phone when i try to upload image from gallery i get error as"Unfortunately, Application has been stopped"

  • Von Neumann

    need to fetch back the image from the server and onto an image view giving but it is giving an because of the way you encrypted the image to the server, is their any special method is should call when retrieving??

  • Tejas Kondhalkar

    hello sir
    Actually in my application..Suppose u want to upload high quality image..then it makes problem …so plz guide me how to solve it

  • Nigel Schepers

    Hey, my camera can't open. It give me the messege "Something wrong while taking photos" How can i fix this or is there a other option?

  • kajal gaikwad

    Sir thank you so much for the tutorial ,But i am not getting image selected from the gallery in imageview
    is there any way to get the image name and display in text view ?

  • Ranjan Kumar

    I am getting this error ,using your PhotoUtil library.Please, help me ………

    android.os.FileUriExposedException: file:///storage/emulated/0/Pictures/JPEG_20170506_234805_1965257583.jpg exposed beyond app through ClipData.Item.getUri()

  • tala salama

    it is not working on my android studio version, and i need it for my project in university so i am very sad :'(

  • Odinga Mubutu

    How do you solve:
    content://media/external/images/media/21 from pid=31080, uid=10050 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()

    I have this error with galaxy s7

  • Shreyas Betal

    I have Android 7.0.0 in my phone. It shows "Something wrong while taking the photo". Which library should i use instead of PhotoUtil.jar?

  • Sikshya Maharjan

    i've manually asked for the camera permission..still i get an error "access denied" after granting the camera access

  • Areeba Shaikh

    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Intent' on a null object reference

    i am getting this error 🙁 pleease help me

  • John Rembo

    How to set Profile Picture size limit when uploading file in Codeigniter

  • ASHU

    haii sir , make a video on uploading video from gallery to user interface i mean t say is when we click on a button we have to get the popout as our own gallery pics and we have to choose one pic among couple of pics…

    plzzzz do task about this task sir

  • Arhbencel

    Hi' good eve. .I have a problem with my code the 'setImageBitmap'..though i followed everything on your video turorial. my code is ivProfilePicture.setImageBitmap(bitmap). the only error is "setImageBitmap"… how to fix this?? thanks 😀

  • Shubham Maheshwari

    not understand the library part.. wat is the link of the library.. it is in contents.. first 2 min… can u elaborate plss…

  • Sachika Nimantha

    I have saved image to SQLite DB as a BLOB type and i want to retrieve it again and set to Image View.
    I captured image using your PhotoUtil. when i convert byte to bitmap it shows an error. how can i do this?
    this is my code snipit
    byte[] image = cursor.getBlob(cursor.getColumnIndex(COL_IMAGE));
    Bitmap bitmap = BitmapFactory.decodeByteArray(image,0,image.length);

    This is the error:
    D/skia: — SkImageDecoder::Factory returned null

  • croco deal

    hi i have a website with a page where you can upload image from Camera & Gallery, all works on my responsive website, same when i check it on my android navigators, but when I create a webview app with android studio my drag&drop zone does not work, when i click in it nothing happened, javascript is already enabled. do you think i forgot something ?

  • Taha Farooqui

    This Tutorial is not working anymore ,Because library is not updated yet. I have tested in Android 5,6 and 7 .
    Sir Oum Saokosal, Please add a note .So people don't waste their time. I spent around 20 min and no result.😞

  • Abhishek Phalke

    hii sir when i install this app my mobile camera not open and click the gallery it say your app is stooped open again but when i run in genymotion device its work help me sir what i do?

  • nndavtyan

    Hello. My name is Armen.
    I have a problem in this lesson. Please help me.
    I use appcompat-v7:26.1.0

    I use the same code and I don't have an error, app is running in my phone without force stop.
    But when I try to capture an image by camera or select from gallery image doesn't show in Imageview .
    I can't find the problem.

  • madhur madan

    I am getting error while converting debug to release version that 11 photo utils classes can not be referenced . Any solution for this?

  • Ontarget Websolutions

    i am getting error of GalleryPhoto class i add photoutill library but still getting error how to resolve this

  • Vishal Shinde

    Please kindly give permission to camera through your settings menu…

    StrictMode.VmPolicy.builder builder = new StrictMode.VmPolicy.builder()
    Add This code in oncreate method if you are facing fileURI issue.

Leave a Reply

Your email address will not be published. Required fields are marked *