{"id":1485,"date":"2022-10-14T12:35:49","date_gmt":"2022-10-14T12:35:49","guid":{"rendered":"https:\/\/infotheme.net\/blog\/?p=1485"},"modified":"2022-10-14T14:17:06","modified_gmt":"2022-10-14T14:17:06","slug":"android-uploading-camera-image-video-to-server-with-progress-bar","status":"publish","type":"post","link":"https:\/\/infotheme.net\/blog\/android-uploading-camera-image-video-to-server-with-progress-bar\/","title":{"rendered":"Android Uploading Camera Image, Video to Server with Progress Bar"},"content":{"rendered":"\n<p>My previous\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/infotheme.net\/blog\/android-downloading-file-by-showing-progress-bar\/\" data-type=\"URL\" data-id=\"https:\/\/infotheme.net\/blog\/android-downloading-file-by-showing-progress-bar\/\" target=\"_blank\">tutorial<\/a>\u00a0explains how to download a file by showing a progress bar.\u00a0In this article I am going to explain how to upload a file to server by showing the progress bar. Using this tutorial you can build an app like\u00a0<strong>Instagram<\/strong>\u00a0where you can capture image or record a video using camera and then upload to a server. On the server side, I used PHP language to read the file and moved it to a particular location.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php.png\"><img loading=\"lazy\" width=\"1024\" height=\"536\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php-1024x536.png\" alt=\"Android Uploading Camera Image\/Video to Server with PHP &amp; Progressbar\" class=\"wp-image-1495\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php-1024x536.png 1024w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php-300x157.png 300w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php-768x402.png 768w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-uploading-using-php.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>The best thing about this article is, it works well with larger file uploads too without any out of memory errors. I have tested the app by uploading&nbsp;<strong>50MB<\/strong>&nbsp;file flawlessly.<\/p>\n\n\n\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#Prerequisite\"><span class=\"toc_number toc_depth_1\">1<\/span> Prerequisite<\/a><\/li><li><a href=\"#1_Creating_Android_Project\"><span class=\"toc_number toc_depth_1\">2<\/span> 1. Creating Android Project<\/a><\/li><li><a href=\"#2_Installing_Configuring_WAMP_Server\"><span class=\"toc_number toc_depth_1\">3<\/span> 2. Installing &amp; Configuring WAMP Server<\/a><\/li><li><a href=\"#3_Creating_PHP_Project\"><span class=\"toc_number toc_depth_1\">4<\/span> 3. Creating PHP Project<\/a><\/li><li><a href=\"#4_Testing_the_File_Upload_localhost\"><span class=\"toc_number toc_depth_1\">5<\/span> 4. Testing the File Upload (localhost)<\/a><\/li><\/ul><\/div>\n<h2><span id=\"Prerequisite\">Prerequisite<\/span><\/h2>\n\n\n\n<p>As this article uploads the image\/video taken from camera, you need to have knowledge over android camera module. So I recommend you go through my previous tutorial&nbsp;<strong><a href=\"https:\/\/infotheme.net\/blog\/android-working-with-camera-using-java\/\" data-type=\"URL\" data-id=\"https:\/\/infotheme.net\/blog\/android-working-with-camera-using-java\/\">Android Working with Camera<\/a><\/strong>&nbsp;which gives you an overview of integrating camera in your android apps.<\/p>\n\n\n\n<h2><span id=\"1_Creating_Android_Project\">1. Creating Android Project<\/span><\/h2>\n\n\n\n<p><strong>1<\/strong>. In Eclipse create a new android project by navigating to&nbsp;<strong>File \u21d2 New \u21d2 Android Application Project<\/strong>&nbsp;and fill out all the required details.<\/p>\n\n\n\n<p><strong>2<\/strong>. Open&nbsp;<strong>strings.xml<\/strong>&nbsp;located under&nbsp;<strong>res \u21d2 values<\/strong>&nbsp;and add below string values.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nstring.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;resources&gt;\n    &lt;string name=&quot;app_name&quot;&gt;Camera File Upload&lt;\/string&gt;\n    &lt;string name=&quot;btnTakePicture&quot;&gt;Capture Image&lt;\/string&gt;\n    &lt;string name=&quot;btnRecordVideo&quot;&gt;Record Video&lt;\/string&gt;\n    &lt;string name=&quot;or&quot;&gt;(or)&lt;\/string&gt;\n    &lt;string name=&quot;btnUploadToServer&quot;&gt;Upload to Server&lt;\/string&gt;\n&lt;\/resources&gt;\n<\/pre>\n\n\n<p><strong>3<\/strong>. Add below color values in&nbsp;<strong>colors.xml<\/strong>&nbsp;located under&nbsp;<strong>res \u21d2 values<\/strong>&nbsp;folder.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncolors.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;resources&gt;\n \n    &lt;color name=&quot;view_background&quot;&gt;#e8ecfa&lt;\/color&gt;\n    &lt;color name=&quot;btn_bg&quot;&gt;#277bec&lt;\/color&gt;\n    &lt;color name=&quot;white&quot;&gt;#ffffff&lt;\/color&gt;\n    &lt;color name=&quot;txt_font&quot;&gt;#4e5572&lt;\/color&gt;\n    &lt;color name=&quot;action_bar&quot;&gt;#1f2649&lt;\/color&gt;\n \n&lt;\/resources&gt;\n<\/pre>\n\n\n<p><strong>4<\/strong>. Now under&nbsp;<strong>src<\/strong>&nbsp;folder create a new class named&nbsp;<strong>Config.java<\/strong>. This class file contains file upload URL and image directory name to save the image\/video on mobile memory. You will have to replace the file upload url with yours while testing.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nConfig.java\npackage net.infotheme.camerafileupload;\n \npublic class Config {\n    \/\/ File upload url (replace the ip with your server address)\n    public static final String FILE_UPLOAD_URL = &quot;http:\/\/192.168.0.104\/AndroidFileUpload\/fileUpload.php&quot;;\n     \n    \/\/ Directory name to store captured images and videos\n    public static final String IMAGE_DIRECTORY_NAME = &quot;Android File Upload&quot;;\n}\n<\/pre>\n\n\n<p><strong>5<\/strong>. Create a class named&nbsp;<strong>AndroidMultiPartEntity.java<\/strong>&nbsp;and paste below code. This class is a custom MultipartEntity class which provides very important functionality required for this project such as progress bar incrementation.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nAndroidMultiPartEntity.java\npackage net.infotheme.camerafileupload;\n \nimport java.io.FilterOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.nio.charset.Charset;\n \nimport org.apache.http.entity.mime.HttpMultipartMode;\nimport org.apache.http.entity.mime.MultipartEntity;\n \n@SuppressWarnings(&quot;deprecation&quot;)\npublic class AndroidMultiPartEntity extends MultipartEntity\n \n{\n \n    private final ProgressListener listener;\n \n    public AndroidMultiPartEntity(final ProgressListener listener) {\n        super();\n        this.listener = listener;\n    }\n \n    public AndroidMultiPartEntity(final HttpMultipartMode mode,\n            final ProgressListener listener) {\n        super(mode);\n        this.listener = listener;\n    }\n \n    public AndroidMultiPartEntity(HttpMultipartMode mode, final String boundary,\n            final Charset charset, final ProgressListener listener) {\n        super(mode, boundary, charset);\n        this.listener = listener;\n    }\n \n    @Override\n    public void writeTo(final OutputStream outstream) throws IOException {\n        super.writeTo(new CountingOutputStream(outstream, this.listener));\n    }\n \n    public static interface ProgressListener {\n        void transferred(long num);\n    }\n \n    public static class CountingOutputStream extends FilterOutputStream {\n \n        private final ProgressListener listener;\n        private long transferred;\n \n        public CountingOutputStream(final OutputStream out,\n                final ProgressListener listener) {\n            super(out);\n            this.listener = listener;\n            this.transferred = 0;\n        }\n \n        public void write(byte[] b, int off, int len) throws IOException {\n            out.write(b, off, len);\n            this.transferred += len;\n            this.listener.transferred(this.transferred);\n        }\n \n        public void write(int b) throws IOException {\n            out.write(b);\n            this.transferred++;\n            this.listener.transferred(this.transferred);\n        }\n    }\n}\n<\/pre>\n\n\n<p>Now we\u2019ll add camera support in our app by creating a simple screen with two buttons to invoke camera app to capture image or record video.<\/p>\n\n\n\n<p><strong>6<\/strong>. Open your&nbsp;<strong>AndroidManifest.xml<\/strong>&nbsp;file and add required permissions. You can notice that&nbsp;<strong>UploadActivity<\/strong>&nbsp;also added in below manifest file. We\u2019ll create it in few minutes.<\/p>\n\n\n\n<p><strong><em>INTERNET<\/em>&nbsp;\u2013<\/strong> Required to make network calls<br><strong><em>WRITE_EXTERNAL_STORAGE<\/em>&nbsp;\u2013 <\/strong>Required to store image\/video on to storage<br><strong><em>RECORD_AUDIO<\/em>&nbsp;\u2013<\/strong> Required to record audio along with video<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nAndroidManifest.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;manifest xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\n    package=&quot;net.infotheme.camerafileupload&quot;\n    android:versionCode=&quot;1&quot;\n    android:versionName=&quot;1.0&quot; &gt;\n \n    &lt;uses-sdk\n        android:minSdkVersion=&quot;11&quot;\n        android:targetSdkVersion=&quot;21&quot; \/&gt;\n \n    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; \/&gt;\n    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; \/&gt;\n    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot; \/&gt;\n \n    &lt;application\n        android:allowBackup=&quot;true&quot;\n        android:icon=&quot;@drawable\/ic_launcher&quot;\n        android:label=&quot;@string\/app_name&quot;\n        android:theme=&quot;@style\/AppTheme&quot; &gt;\n        &lt;activity\n            android:name=&quot;net.infotheme.camerafileupload.MainActivity&quot;\n            android:label=&quot;@string\/app_name&quot;\n            android:screenOrientation=&quot;portrait&quot; &gt;\n            &lt;intent-filter&gt;\n                &lt;action android:name=&quot;android.intent.action.MAIN&quot; \/&gt;\n \n                &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; \/&gt;\n            &lt;\/intent-filter&gt;\n        &lt;\/activity&gt;\n        &lt;activity\n            android:name=&quot;net.infotheme.camerafileupload.UploadActivity&quot;\n            android:screenOrientation=&quot;portrait&quot; &gt;\n        &lt;\/activity&gt;\n    &lt;\/application&gt;\n \n&lt;\/manifest&gt;\n<\/pre>\n\n\n<p><strong>7<\/strong>. Open the layout file of your main activity (<strong>activity_main.xml<\/strong>) and add below code. This creates a layout with two buttons.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nactivity_main.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;RelativeLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\n    xmlns:tools=&quot;http:\/\/schemas.android.com\/tools&quot;\n    android:layout_width=&quot;fill_parent&quot;\n    android:layout_height=&quot;fill_parent&quot;\n    android:background=&quot;@color\/view_background&quot;\n    android:baselineAligned=&quot;false&quot;\n    android:orientation=&quot;vertical&quot; &gt;\n \n    &lt;LinearLayout\n        android:layout_width=&quot;fill_parent&quot;\n        android:layout_height=&quot;wrap_content&quot;\n        android:layout_centerInParent=&quot;true&quot;\n        android:gravity=&quot;center&quot;\n        android:orientation=&quot;vertical&quot; &gt;\n \n        &lt;!-- Capture picture button --&gt;\n \n        &lt;Button\n            android:id=&quot;@+id\/btnCapturePicture&quot;\n            android:layout_width=&quot;wrap_content&quot;\n            android:layout_height=&quot;wrap_content&quot;\n            android:layout_marginBottom=&quot;20dp&quot;\n            android:background=&quot;@color\/btn_bg&quot;\n            android:paddingLeft=&quot;20dp&quot;\n            android:paddingRight=&quot;20dp&quot;\n            android:text=&quot;@string\/btnTakePicture&quot;\n            android:textColor=&quot;@color\/white&quot; \/&gt;\n \n        &lt;TextView\n            android:layout_width=&quot;wrap_content&quot;\n            android:layout_height=&quot;wrap_content&quot;\n            android:layout_marginBottom=&quot;20dp&quot;\n            android:gravity=&quot;center_horizontal&quot;\n            android:text=&quot;@string\/or&quot;\n            android:textColor=&quot;@color\/txt_font&quot; \/&gt;\n \n        &lt;!-- Record video button --&gt;\n \n        &lt;Button\n            android:id=&quot;@+id\/btnRecordVideo&quot;\n            android:layout_width=&quot;wrap_content&quot;\n            android:layout_height=&quot;wrap_content&quot;\n            android:background=&quot;@color\/btn_bg&quot;\n            android:paddingLeft=&quot;20dp&quot;\n            android:paddingRight=&quot;20dp&quot;\n            android:text=&quot;@string\/btnRecordVideo&quot;\n            android:textColor=&quot;@color\/white&quot; \/&gt;\n    &lt;\/LinearLayout&gt;\n \n&lt;\/RelativeLayout&gt;\n<\/pre>\n\n\n<p><strong>8<\/strong>. Add below camera related code in your&nbsp;<strong>MainActivity.java<\/strong>&nbsp;class. This code is directly taken from this&nbsp;<strong>tutorial.<\/strong><\/p>\n\n\n\n<p>In brief what this activity will do is,<\/p>\n\n\n\n<p><strong>&gt;<\/strong>&nbsp;Camera app will be launched on tapping take picture or record video button.<br><strong>&gt;<\/strong>&nbsp;Once the image \/ video is captured, it will be stored on to mobile SDCard.<br><strong>&gt;<\/strong>&nbsp;Finally UploadActivity will be launched by passing the SDCard path of the media that is captured. The process of uploading will be done in UploadActivity.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nMainActivity.java\npackage net.infotheme.camerafileupload;\n \nimport java.io.File;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.Locale;\n \nimport android.app.Activity;\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.graphics.Color;\nimport android.graphics.drawable.ColorDrawable;\nimport android.net.Uri;\nimport android.os.Bundle;\nimport android.os.Environment;\nimport android.provider.MediaStore;\nimport android.util.Log;\nimport android.view.View;\nimport android.widget.Button;\nimport android.widget.Toast;\n \npublic class MainActivity extends Activity {\n     \n    \/\/ LogCat tag\n    private static final String TAG = MainActivity.class.getSimpleName();\n     \n  \n    \/\/ Camera activity request codes\n    private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100;\n    private static final int CAMERA_CAPTURE_VIDEO_REQUEST_CODE = 200;\n     \n    public static final int MEDIA_TYPE_IMAGE = 1;\n    public static final int MEDIA_TYPE_VIDEO = 2;\n  \n    private Uri fileUri; \/\/ file url to store image\/video\n     \n    private Button btnCapturePicture, btnRecordVideo;\n  \n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n         \n        \/\/ Changing action bar background color\n        \/\/ These two lines are not needed\n        getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(getResources().getString(R.color.action_bar))));\n  \n        btnCapturePicture = (Button) findViewById(R.id.btnCapturePicture);\n        btnRecordVideo = (Button) findViewById(R.id.btnRecordVideo);\n  \n        \/**\n         * Capture image button click event\n         *\/\n        btnCapturePicture.setOnClickListener(new View.OnClickListener() {\n  \n            @Override\n            public void onClick(View v) {\n                \/\/ capture picture\n                captureImage();\n            }\n        });\n  \n        \/**\n         * Record video button click event\n         *\/\n        btnRecordVideo.setOnClickListener(new View.OnClickListener() {\n  \n            @Override\n            public void onClick(View v) {\n                \/\/ record video\n                recordVideo();\n            }\n        });\n  \n        \/\/ Checking camera availability\n        if (!isDeviceSupportCamera()) {\n            Toast.makeText(getApplicationContext(),\n                    &quot;Sorry! Your device doesn&#039;t support camera&quot;,\n                    Toast.LENGTH_LONG).show();\n            \/\/ will close the app if the device does&#039;t have camera\n            finish();\n        }\n    }\n  \n    \/**\n     * Checking device has camera hardware or not\n     * *\/\n    private boolean isDeviceSupportCamera() {\n        if (getApplicationContext().getPackageManager().hasSystemFeature(\n                PackageManager.FEATURE_CAMERA)) {\n            \/\/ this device has a camera\n            return true;\n        } else {\n            \/\/ no camera on this device\n            return false;\n        }\n    }\n  \n    \/**\n     * Launching camera app to capture image\n     *\/\n    private void captureImage() {\n        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n  \n        fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);\n  \n        intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);\n  \n        \/\/ start the image capture Intent\n        startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);\n    }\n     \n    \/**\n     * Launching camera app to record video\n     *\/\n    private void recordVideo() {\n        Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);\n  \n        fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);\n  \n        \/\/ set video quality\n        intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);\n  \n        intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); \/\/ set the image file\n                                                            \/\/ name\n  \n        \/\/ start the video capture Intent\n        startActivityForResult(intent, CAMERA_CAPTURE_VIDEO_REQUEST_CODE);\n    }\n  \n    \/**\n     * Here we store the file url as it will be null after returning from camera\n     * app\n     *\/\n    @Override\n    protected void onSaveInstanceState(Bundle outState) {\n        super.onSaveInstanceState(outState);\n  \n        \/\/ save file url in bundle as it will be null on screen orientation\n        \/\/ changes\n        outState.putParcelable(&quot;file_uri&quot;, fileUri);\n    }\n  \n    @Override\n    protected void onRestoreInstanceState(Bundle savedInstanceState) {\n        super.onRestoreInstanceState(savedInstanceState);\n  \n        \/\/ get the file url\n        fileUri = savedInstanceState.getParcelable(&quot;file_uri&quot;);\n    }\n  \n     \n  \n    \/**\n     * Receiving activity result method will be called after closing the camera\n     * *\/\n    @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        \/\/ if the result is capturing Image\n        if (requestCode == CAMERA_CAPTURE_IMAGE_REQUEST_CODE) {\n            if (resultCode == RESULT_OK) {\n                 \n                \/\/ successfully captured the image\n                \/\/ launching upload activity\n                launchUploadActivity(true);\n                 \n                 \n            } else if (resultCode == RESULT_CANCELED) {\n                 \n                \/\/ user cancelled Image capture\n                Toast.makeText(getApplicationContext(),\n                        &quot;User cancelled image capture&quot;, Toast.LENGTH_SHORT)\n                        .show();\n             \n            } else {\n                \/\/ failed to capture image\n                Toast.makeText(getApplicationContext(),\n                        &quot;Sorry! Failed to capture image&quot;, Toast.LENGTH_SHORT)\n                        .show();\n            }\n         \n        } else if (requestCode == CAMERA_CAPTURE_VIDEO_REQUEST_CODE) {\n            if (resultCode == RESULT_OK) {\n                 \n                \/\/ video successfully recorded\n                \/\/ launching upload activity\n                launchUploadActivity(false);\n             \n            } else if (resultCode == RESULT_CANCELED) {\n                 \n                \/\/ user cancelled recording\n                Toast.makeText(getApplicationContext(),\n                        &quot;User cancelled video recording&quot;, Toast.LENGTH_SHORT)\n                        .show();\n             \n            } else {\n                \/\/ failed to record video\n                Toast.makeText(getApplicationContext(),\n                        &quot;Sorry! Failed to record video&quot;, Toast.LENGTH_SHORT)\n                        .show();\n            }\n        }\n    }\n     \n    private void launchUploadActivity(boolean isImage){\n        Intent i = new Intent(MainActivity.this, UploadActivity.class);\n        i.putExtra(&quot;filePath&quot;, fileUri.getPath());\n        i.putExtra(&quot;isImage&quot;, isImage);\n        startActivity(i);\n    }\n      \n    \/**\n     * ------------ Helper Methods ---------------------- \n     * *\/\n  \n    \/**\n     * Creating file uri to store image\/video\n     *\/\n    public Uri getOutputMediaFileUri(int type) {\n        return Uri.fromFile(getOutputMediaFile(type));\n    }\n  \n    \/**\n     * returning image \/ video\n     *\/\n    private static File getOutputMediaFile(int type) {\n  \n        \/\/ External sdcard location\n        File mediaStorageDir = new File(\n                Environment\n                        .getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),\n                Config.IMAGE_DIRECTORY_NAME);\n  \n        \/\/ Create the storage directory if it does not exist\n        if (!mediaStorageDir.exists()) {\n            if (!mediaStorageDir.mkdirs()) {\n                Log.d(TAG, &quot;Oops! Failed create &quot;\n                        + Config.IMAGE_DIRECTORY_NAME + &quot; directory&quot;);\n                return null;\n            }\n        }\n  \n        \/\/ Create a media file name\n        String timeStamp = new SimpleDateFormat(&quot;yyyyMMdd_HHmmss&quot;,\n                Locale.getDefault()).format(new Date());\n        File mediaFile;\n        if (type == MEDIA_TYPE_IMAGE) {\n            mediaFile = new File(mediaStorageDir.getPath() + File.separator\n                    + &quot;IMG_&quot; + timeStamp + &quot;.jpg&quot;);\n        } else if (type == MEDIA_TYPE_VIDEO) {\n            mediaFile = new File(mediaStorageDir.getPath() + File.separator\n                    + &quot;VID_&quot; + timeStamp + &quot;.mp4&quot;);\n        } else {\n            return null;\n        }\n  \n        return mediaFile;\n    }\n}\n<\/pre>\n\n\n<p>Now if you run the app, you should see following output.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-screen-1.jpg\"><img loading=\"lazy\" width=\"718\" height=\"789\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-screen-1.jpg\" alt=\"\" class=\"wp-image-1489\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-screen-1.jpg 718w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-screen-1-273x300.jpg 273w\" sizes=\"(max-width: 718px) 100vw, 718px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-taking-camera-picture-1.jpg\"><img loading=\"lazy\" width=\"719\" height=\"459\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-taking-camera-picture-1.jpg\" alt=\"\" class=\"wp-image-1490\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-taking-camera-picture-1.jpg 719w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-file-upload-camera-taking-camera-picture-1-300x192.jpg 300w\" sizes=\"(max-width: 719px) 100vw, 719px\" \/><\/a><\/figure>\n\n\n\n<p>Once you are able to launch camera and capture images, we can move forward and start creating the upload activity.<\/p>\n\n\n\n<p><strong>9<\/strong>. Create an xml file under&nbsp;<strong>res \u21d2 layout<\/strong>&nbsp;folder named&nbsp;<strong>activity_upload.xml<\/strong>. This layout contains&nbsp;<strong>ImageView<\/strong>,&nbsp;<strong>VideoView<\/strong>&nbsp;to preview the captured media and a&nbsp;<strong>ProgressBar<\/strong>&nbsp;to show uploading progress.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nactivity_upload.xml\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;LinearLayout xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\n    android:layout_width=&quot;fill_parent&quot;\n    android:layout_height=&quot;fill_parent&quot;\n    android:background=&quot;@color\/view_background&quot;\n    android:orientation=&quot;vertical&quot;\n    android:padding=&quot;10dp&quot; &gt;\n \n     \n \n    &lt;!-- To display picture taken --&gt;\n \n    &lt;ImageView\n        android:id=&quot;@+id\/imgPreview&quot;\n        android:layout_width=&quot;fill_parent&quot;\n        android:layout_height=&quot;200dp&quot;\n        android:visibility=&quot;gone&quot;\n        android:layout_marginTop=&quot;15dp&quot;\/&gt;\n \n    &lt;!-- Videoview to preview recorded video --&gt;\n \n    &lt;VideoView\n        android:id=&quot;@+id\/videoPreview&quot;\n        android:layout_width=&quot;fill_parent&quot;\n        android:layout_height=&quot;400dp&quot;\n        android:visibility=&quot;gone&quot;\n        android:layout_marginTop=&quot;15dp&quot;\/&gt;\n \n    &lt;TextView\n        android:id=&quot;@+id\/txtPercentage&quot;\n        android:layout_width=&quot;wrap_content&quot;\n        android:layout_height=&quot;wrap_content&quot;\n        android:layout_gravity=&quot;center_horizontal&quot;\n        android:layout_marginBottom=&quot;15dp&quot;\n        android:layout_marginTop=&quot;15dp&quot;\n        android:textColor=&quot;@color\/txt_font&quot;\n        android:textSize=&quot;30dp&quot; \/&gt;\n \n    &lt;ProgressBar\n        android:id=&quot;@+id\/progressBar&quot;\n        style=&quot;?android:attr\/progressBarStyleHorizontal&quot;\n        android:layout_width=&quot;fill_parent&quot;\n        android:layout_height=&quot;20dp&quot;\n        android:layout_marginBottom=&quot;35dp&quot;\n        android:visibility=&quot;gone&quot;\/&gt;\n \n    &lt;Button\n        android:id=&quot;@+id\/btnUpload&quot;\n        android:layout_width=&quot;wrap_content&quot;\n        android:layout_height=&quot;wrap_content&quot;\n        android:layout_gravity=&quot;center_horizontal&quot;\n        android:background=&quot;@color\/btn_bg&quot;\n        android:paddingLeft=&quot;20dp&quot;\n        android:paddingRight=&quot;20dp&quot;\n        android:text=&quot;@string\/btnUploadToServer&quot;\n        android:textColor=&quot;@color\/white&quot;\n        android:layout_marginBottom=&quot;20dp&quot;\/&gt;\n \n&lt;\/LinearLayout&gt;\n<\/pre>\n\n\n<p><strong>10<\/strong>. Create a class named&nbsp;<strong>UploadActivity.java<\/strong>&nbsp;and paste below code. In this activity<\/p>\n\n\n\n<p><strong>&gt;<\/strong>&nbsp;The path of captured camera image\/video is received from MainActivity and image\/video is displayed on the screen for preview purpose.<br><strong>&gt;<\/strong>&nbsp;<strong>UploadFileToServer<\/strong>&nbsp;async method takes care of uploading file to server and updating the Progress Bar.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nUploadActivity.java\npackage net.infotheme.camerafileupload;\n \nimport net.infotheme.camerafileupload.AndroidMultiPartEntity.ProgressListener;\n \nimport java.io.File;\nimport java.io.IOException;\n \nimport org.apache.http.HttpEntity;\nimport org.apache.http.HttpResponse;\nimport org.apache.http.client.ClientProtocolException;\nimport org.apache.http.client.HttpClient;\nimport org.apache.http.client.methods.HttpPost;\nimport org.apache.http.entity.mime.content.FileBody;\nimport org.apache.http.entity.mime.content.StringBody;\nimport org.apache.http.impl.client.DefaultHttpClient;\nimport org.apache.http.util.EntityUtils;\n \nimport android.app.Activity;\nimport android.app.AlertDialog;\nimport android.content.DialogInterface;\nimport android.content.Intent;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.Color;\nimport android.graphics.drawable.ColorDrawable;\nimport android.os.AsyncTask;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.View;\nimport android.widget.Button;\nimport android.widget.ImageView;\nimport android.widget.ProgressBar;\nimport android.widget.TextView;\nimport android.widget.Toast;\nimport android.widget.VideoView;\n \npublic class UploadActivity extends Activity {\n    \/\/ LogCat tag\n    private static final String TAG = MainActivity.class.getSimpleName();\n \n    private ProgressBar progressBar;\n    private String filePath = null;\n    private TextView txtPercentage;\n    private ImageView imgPreview;\n    private VideoView vidPreview;\n    private Button btnUpload;\n    long totalSize = 0;\n \n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_upload);\n        txtPercentage = (TextView) findViewById(R.id.txtPercentage);\n        btnUpload = (Button) findViewById(R.id.btnUpload);\n        progressBar = (ProgressBar) findViewById(R.id.progressBar);\n        imgPreview = (ImageView) findViewById(R.id.imgPreview);\n        vidPreview = (VideoView) findViewById(R.id.videoPreview);\n \n        \/\/ Changing action bar background color\n        getActionBar().setBackgroundDrawable(\n                new ColorDrawable(Color.parseColor(getResources().getString(\n                        R.color.action_bar))));\n \n        \/\/ Receiving the data from previous activity\n        Intent i = getIntent();\n \n        \/\/ image or video path that is captured in previous activity\n        filePath = i.getStringExtra(&quot;filePath&quot;);\n \n        \/\/ boolean flag to identify the media type, image or video\n        boolean isImage = i.getBooleanExtra(&quot;isImage&quot;, true);\n \n        if (filePath != null) {\n            \/\/ Displaying the image or video on the screen\n            previewMedia(isImage);\n        } else {\n            Toast.makeText(getApplicationContext(),\n                    &quot;Sorry, file path is missing!&quot;, Toast.LENGTH_LONG).show();\n        }\n \n        btnUpload.setOnClickListener(new View.OnClickListener() {\n \n            @Override\n            public void onClick(View v) {\n                \/\/ uploading the file to server\n                new UploadFileToServer().execute();\n            }\n        });\n \n    }\n \n    \/**\n     * Displaying captured image\/video on the screen\n     * *\/\n    private void previewMedia(boolean isImage) {\n        \/\/ Checking whether captured media is image or video\n        if (isImage) {\n            imgPreview.setVisibility(View.VISIBLE);\n            vidPreview.setVisibility(View.GONE);\n            \/\/ bimatp factory\n            BitmapFactory.Options options = new BitmapFactory.Options();\n \n            \/\/ down sizing image as it throws OutOfMemory Exception for larger\n            \/\/ images\n            options.inSampleSize = 8;\n \n            final Bitmap bitmap = BitmapFactory.decodeFile(filePath, options);\n \n            imgPreview.setImageBitmap(bitmap);\n        } else {\n            imgPreview.setVisibility(View.GONE);\n            vidPreview.setVisibility(View.VISIBLE);\n            vidPreview.setVideoPath(filePath);\n            \/\/ start playing\n            vidPreview.start();\n        }\n    }\n \n    \/**\n     * Uploading the file to server\n     * *\/\n    private class UploadFileToServer extends AsyncTask&lt;Void, Integer, String&gt; {\n        @Override\n        protected void onPreExecute() {\n            \/\/ setting progress bar to zero\n            progressBar.setProgress(0);\n            super.onPreExecute();\n        }\n \n        @Override\n        protected void onProgressUpdate(Integer... progress) {\n            \/\/ Making progress bar visible\n            progressBar.setVisibility(View.VISIBLE);\n \n            \/\/ updating progress bar value\n            progressBar.setProgress(progress[0]);\n \n            \/\/ updating percentage value\n            txtPercentage.setText(String.valueOf(progress[0]) + &quot;%&quot;);\n        }\n \n        @Override\n        protected String doInBackground(Void... params) {\n            return uploadFile();\n        }\n \n        @SuppressWarnings(&quot;deprecation&quot;)\n        private String uploadFile() {\n            String responseString = null;\n \n            HttpClient httpclient = new DefaultHttpClient();\n            HttpPost httppost = new HttpPost(Config.FILE_UPLOAD_URL);\n \n            try {\n                AndroidMultiPartEntity entity = new AndroidMultiPartEntity(\n                        new ProgressListener() {\n \n                            @Override\n                            public void transferred(long num) {\n                                publishProgress((int) ((num \/ (float) totalSize) * 100));\n                            }\n                        });\n \n                File sourceFile = new File(filePath);\n \n                \/\/ Adding file data to http body\n                entity.addPart(&quot;image&quot;, new FileBody(sourceFile));\n \n                \/\/ Extra parameters if you want to pass to server\n                entity.addPart(&quot;website&quot;,\n                        new StringBody(&quot;www.infotheme.net&quot;));\n                entity.addPart(&quot;email&quot;, new StringBody(&quot;abc@gmail.com&quot;));\n \n                totalSize = entity.getContentLength();\n                httppost.setEntity(entity);\n \n                \/\/ Making server call\n                HttpResponse response = httpclient.execute(httppost);\n                HttpEntity r_entity = response.getEntity();\n \n                int statusCode = response.getStatusLine().getStatusCode();\n                if (statusCode == 200) {\n                    \/\/ Server response\n                    responseString = EntityUtils.toString(r_entity);\n                } else {\n                    responseString = &quot;Error occurred! Http Status Code: &quot;\n                            + statusCode;\n                }\n \n            } catch (ClientProtocolException e) {\n                responseString = e.toString();\n            } catch (IOException e) {\n                responseString = e.toString();\n            }\n \n            return responseString;\n \n        }\n \n        @Override\n        protected void onPostExecute(String result) {\n            Log.e(TAG, &quot;Response from server: &quot; + result);\n \n            \/\/ showing the server response in an alert dialog\n            showAlert(result);\n \n            super.onPostExecute(result);\n        }\n \n    }\n \n    \/**\n     * Method to show alert dialog\n     * *\/\n    private void showAlert(String message) {\n        AlertDialog.Builder builder = new AlertDialog.Builder(this);\n        builder.setMessage(message).setTitle(&quot;Response from Servers&quot;)\n                .setCancelable(false)\n                .setPositiveButton(&quot;OK&quot;, new DialogInterface.OnClickListener() {\n                    public void onClick(DialogInterface dialog, int id) {\n                        \/\/ do nothing\n                    }\n                });\n        AlertDialog alert = builder.create();\n        alert.show();\n    }\n \n}\n<\/pre>\n\n\n<p>Until now we are done with android project. Now let\u2019s quickly create the PHP project to receive the file that is being sent from android app. But before that, we need to do small configuration changes to WAMP server.<\/p>\n\n\n\n<h2><span id=\"2_Installing_Configuring_WAMP_Server\">2. Installing &amp; Configuring WAMP Server<\/span><\/h2>\n\n\n\n<p><strong>1<\/strong>. Download and install&nbsp;<a href=\"https:\/\/www.wampserver.com\/en\/\" data-type=\"URL\" data-id=\"https:\/\/www.wampserver.com\/en\/\" rel=\"nofollow noopener\" target=\"_blank\">WAMP<\/a>&nbsp;software. On windows machine, WAMP will be installed at&nbsp;<strong>C:\\wamp<\/strong>&nbsp;location.<\/p>\n\n\n\n<p><strong>2<\/strong>. Open&nbsp;<strong>php.ini<\/strong>&nbsp;and modify below values. By default wamp server allows maximum of&nbsp;<strong>2MB<\/strong>&nbsp;file only to upload. After changing the below values, you can upload the files upto&nbsp;<strong>50MB<\/strong>&nbsp;size.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nupload_max_filesize = 50M\npost_max_size = 50M\nmax_input_time = 300\nmax_execution_time = 300\n<\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/wamp-server-editing-php.ini-file1-1.png\"><img loading=\"lazy\" width=\"720\" height=\"382\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/wamp-server-editing-php.ini-file1-1.png\" alt=\"\" class=\"wp-image-1491\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/wamp-server-editing-php.ini-file1-1.png 720w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/wamp-server-editing-php.ini-file1-1-300x159.png 300w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/figure>\n\n\n\n<p><strong>3<\/strong>. Now restart the WAMP server.<\/p>\n\n\n\n<h2><span id=\"3_Creating_PHP_Project\">3. Creating PHP Project<\/span><\/h2>\n\n\n\n<p><strong>1<\/strong>. Go inside&nbsp;<strong>C:\\wamp\\www<\/strong>&nbsp;and create a folder named&nbsp;<strong>AndroidFileUpload<\/strong>. This will be the root directory of our project.<\/p>\n\n\n\n<p><strong>2<\/strong>. Now go into&nbsp;<strong>AndroidFileUpload<\/strong>&nbsp;folder and create a folder named&nbsp;<strong>uploads<\/strong>&nbsp;to keep all the uploaded files.<\/p>\n\n\n\n<p><strong>3<\/strong>. Create a file named&nbsp;<strong>fileUpload.php<\/strong>&nbsp;and paste below content. Below php code takes care of receiving the files from android app and store them in uploads folder. Upon the processing the file, server responds with a JSON message.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfileUpload.php\n&lt;?php\n \n\/\/ Path to move uploaded files\n$target_path = &quot;uploads\/&quot;;\n \n\/\/ array for final json respone\n$response = array();\n \n\/\/ getting server ip address\n$server_ip = gethostbyname(gethostname());\n \n\/\/ final file url that is being uploaded\n$file_upload_url = &#039;http:\/\/&#039; . $server_ip . &#039;\/&#039; . &#039;AndroidFileUpload&#039; . &#039;\/&#039; . $target_path;\n \n \nif (isset($_FILES[&#039;image&#039;][&#039;name&#039;])) {\n    $target_path = $target_path . basename($_FILES[&#039;image&#039;][&#039;name&#039;]);\n \n    \/\/ reading other post parameters\n    $email = isset($_POST[&#039;email&#039;]) ? $_POST[&#039;email&#039;] : &#039;&#039;;\n    $website = isset($_POST[&#039;website&#039;]) ? $_POST[&#039;website&#039;] : &#039;&#039;;\n \n    $response[&#039;file_name&#039;] = basename($_FILES[&#039;image&#039;][&#039;name&#039;]);\n    $response[&#039;email&#039;] = $email;\n    $response[&#039;website&#039;] = $website;\n \n    try {\n        \/\/ Throws exception incase file is not being moved\n        if (!move_uploaded_file($_FILES[&#039;image&#039;][&#039;tmp_name&#039;], $target_path)) {\n            \/\/ make error flag true\n            $response[&#039;error&#039;] = true;\n            $response[&#039;message&#039;] = &#039;Could not move the file!&#039;;\n        }\n \n        \/\/ File successfully uploaded\n        $response[&#039;message&#039;] = &#039;File uploaded successfully!&#039;;\n        $response[&#039;error&#039;] = false;\n        $response[&#039;file_path&#039;] = $file_upload_url . basename($_FILES[&#039;image&#039;][&#039;name&#039;]);\n    } catch (Exception $e) {\n        \/\/ Exception occurred. Make error flag true\n        $response[&#039;error&#039;] = true;\n        $response[&#039;message&#039;] = $e-&gt;getMessage();\n    }\n} else {\n    \/\/ File parameter is missing\n    $response[&#039;error&#039;] = true;\n    $response[&#039;message&#039;] = &#039;Not received any file!F&#039;;\n}\n \n\/\/ Echo final json response to client\necho json_encode($response);\n?&gt;\n<\/pre>\n\n\n<p>Below is the sample JSON response if the file is uploaded successfully. You can use&nbsp;<strong>error<\/strong>&nbsp;value to verify the upload on android side.<\/p>\n\n\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n{\n    &quot;file_name&quot;: &quot;DSC_0021.JPG&quot;,\n    &quot;email&quot;: &quot;admin@infotheme.net&quot;,\n    &quot;website&quot;: &quot;www.infotheme.net&quot;,\n    &quot;message&quot;: &quot;File uploaded successfully!&quot;,\n    &quot;error&quot;: false,\n    &quot;file_path&quot;: &quot;http:\/\/192.168.0.104\/AndroidFileUpload\/uploads\/DSC_0021.JPG&quot;\n}\n<\/pre>\n\n\n<h2><span id=\"4_Testing_the_File_Upload_localhost\">4. Testing the File Upload (localhost)<\/span><\/h2>\n\n\n\n<p>The following steps shows you how to test the both apps together locally.<\/p>\n\n\n\n<p><strong>1<\/strong>. Connect the both the devices (machine running the wamp server &amp; android mobile) to same wifi network.<\/p>\n\n\n\n<p><strong>2<\/strong>. Start the WAMP server.<\/p>\n\n\n\n<p><strong>3<\/strong>. Get the ip address of the machine that is running the PHP project. You can get the ip address by typing&nbsp;<strong>ipconfig<\/strong>&nbsp;in command prompt. (On mac os, use&nbsp;<strong>ifconfig<\/strong>&nbsp;to get the ip address)<\/p>\n\n\n\n<p><strong>4<\/strong>. Replace the ip address in&nbsp;<strong>Config.java<\/strong>&nbsp;(check 4th step in android project) with your ip address.<\/p>\n\n\n\n<p><strong>5<\/strong>. Deploy &amp; run the android app on the mobile.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server-1.jpg\"><img loading=\"lazy\" width=\"720\" height=\"788\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server-1.jpg\" alt=\"\" class=\"wp-image-1492\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server-1.jpg 720w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server-1-274x300.jpg 274w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server1-1.jpg\"><img loading=\"lazy\" width=\"720\" height=\"787\" src=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server1-1.jpg\" alt=\"\" class=\"wp-image-1493\" srcset=\"https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server1-1.jpg 720w, https:\/\/infotheme.net\/blog\/wp-content\/uploads\/2022\/10\/android-uploading-camera-picture-to-server1-1-274x300.jpg 274w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/a><\/figure>\n\n\n\n<p><strong>References<\/strong><br>1.&nbsp;<a href=\"https:\/\/stackoverflow.com\/questions\/22874735\/upload-large-file-with-progress-bar-and-without-outofmemory-error-in-android\" rel=\"nofollow noopener\" target=\"_blank\">Stackoverflow Question&nbsp;<\/a>about file upload with progress bar.<br>2.&nbsp;<a href=\"https:\/\/www.iconfinder.com\/icons\/66782\/file_upload_icon#size=128\" rel=\"nofollow noopener\" target=\"_blank\">Icon<\/a>&nbsp;that I used as app icon.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My previous\u00a0tutorial\u00a0explains how to download a file by showing a progress bar.\u00a0In this article I am going to explain how to upload a file to [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/infotheme.net\/blog\/android-uploading-camera-image-video-to-server-with-progress-bar\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1495,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[157,135,1],"tags":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/posts\/1485"}],"collection":[{"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/comments?post=1485"}],"version-history":[{"count":5,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/posts\/1485\/revisions"}],"predecessor-version":[{"id":1530,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/posts\/1485\/revisions\/1530"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/media\/1495"}],"wp:attachment":[{"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/media?parent=1485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/categories?post=1485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infotheme.net\/blog\/wp-json\/wp\/v2\/tags?post=1485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}