├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_cloud_upload_white_36dp.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_cloud_upload_white_36dp.png │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_cloud_upload_white_36dp.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_cloud_upload_white_36dp.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── ic_cloud_upload_white_36dp.png │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── menu │ │ │ │ └── menu_main.xml │ │ │ └── layout │ │ │ │ ├── content_main.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── androidbuts │ │ │ │ ├── utils │ │ │ │ └── InternetConnection.java │ │ │ │ ├── permission │ │ │ │ ├── PermissionsChecker.java │ │ │ │ └── PermissionsActivity.java │ │ │ │ ├── parser │ │ │ │ └── JSONParser.java │ │ │ │ └── uploadimage │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── androidbuts │ │ │ └── uploadimage │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── androidbuts │ │ └── uploadimage │ │ └── ApplicationTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── vcs.xml ├── modules.xml ├── libraries │ ├── junit_4_12.xml │ ├── okio_1_9_0.xml │ ├── okhttp_3_4_1.xml │ ├── picasso_2_5_2.xml │ ├── hamcrest_core_1_3.xml │ ├── support_annotations_23_4_0.xml │ ├── support_vector_drawable_23_4_0.xml │ ├── animated_vector_drawable_23_4_0.xml │ ├── design_23_4_0.xml │ ├── appcompat_v7_23_4_0.xml │ ├── recyclerview_v7_23_4_0.xml │ └── support_v4_23_4_0.xml ├── runConfigurations.xml ├── compiler.xml ├── gradle.xml └── misc.xml ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── php_upload └── upload.php ├── .gitignore ├── gradle.properties ├── UploadImage.iml ├── Upload_Image_OKHTTP.iml ├── gradlew.bat ├── gradlew └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Upload_Image_OKHTTP -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_cloud_upload_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/drawable-hdpi/ic_cloud_upload_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_cloud_upload_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/drawable-mdpi/ic_cloud_upload_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_cloud_upload_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/drawable-xhdpi/ic_cloud_upload_white_36dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_cloud_upload_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/drawable-xxhdpi/ic_cloud_upload_white_36dp.png -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_cloud_upload_white_36dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratikbutani/OKHTTPUploadImage/HEAD/app/src/main/res/drawable-xxxhdpi/ic_cloud_upload_white_36dp.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed May 04 17:10:41 IST 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OKHTTPUploadImage 2 | 3 | Uploading Image using OKHTTP. 4 | 5 | You can check my answers on StackOverflow for [Single Image Upload using OkHttp](http://stackoverflow.com/a/34127008/1318946) and [Multiple Image Upload using OkHttp](http://stackoverflow.com/a/34411666/1318946) 6 | 7 | Thank you. Keep Sharing. -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | > 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /php_upload/upload.php: -------------------------------------------------------------------------------- 1 | "success"); 8 | } else{ 9 | $result = array("result" => "error"); 10 | } 11 | 12 | echo json_encode($result); 13 | 14 | ?> 15 | -------------------------------------------------------------------------------- /app/src/test/java/com/androidbuts/uploadimage/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.androidbuts.uploadimage; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/androidbuts/uploadimage/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.androidbuts.uploadimage; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | -------------------------------------------------------------------------------- /.idea/libraries/okio_1_9_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/okhttp_3_4_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/androidbuts/utils/InternetConnection.java: -------------------------------------------------------------------------------- 1 | package com.androidbuts.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | 6 | /** 7 | * 8 | * @author Pratik Butani 9 | * 10 | */ 11 | public class InternetConnection { 12 | 13 | /** CHECK WHETHER INTERNET CONNECTION IS AVAILABLE OR NOT */ 14 | public static boolean checkConnection(Context context) { 15 | return ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE)).getActiveNetworkInfo() != null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.idea/libraries/picasso_2_5_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_23_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\Android\Android_SDK_and_Eclipse\andriod-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 |