Git Product home page Git Product logo

androiduploadimage's Introduction

Tutorials This Code Is Based On 

This is where I started
http://www.coderefer.com/android-upload-file-to-server/

But this does not have Image taking part, also it does not implement the network in 
AsyncTask, so Some modifications needed to be made. 


AsyncTask addition is based purely on this:
https://developer.android.com/training/basics/network-ops/connecting.html
I did not change the HttpUrlConnection related functions at all, only functions which from 
asyncctask refered to the parent functions. 


Android Image Taking 
Started with the general: 
https://developer.android.com/training/camera/photobasics.html , but this is only relevant 
until the part where you do file saving/retrieving as some other info is somewhat inaccurate.
Like the part, where you retrieve files based on absolute path. That will give you so 
much inaccurate headace
Things which helped me a lot in regards to the file storing/retrieving part
and overall enforced me to use clear good practices 

 
https://androidkennel.org/android-camera-access-tutorial/  
https://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory
Part where thee is the getExternalStoragePublicDirectory example. 
Just a lot of reading about: 
Uri-s, FileProvider, How Android directories are files. How Uris are used both inside
outside apps, because Android focuses it to be something similiar to http as I heard from
interente. 


Different methods to retrieve directories. 

new File(Enviroment.getExternalStorageDirectory() + CAMERA_DIR +albumName)
After Froyo
return new File(
		  Environment.getExternalStoragePublicDirectory(
		    Environment.DIRECTORY_PICTURES
		  ), 
		  albumName
		);
My school example 
new File(Enviroment.getExternalStorageDirectory.getPath)
From good example 
https://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory(java.lang.String)
File path = Environment.getExternalStoragePublicDirectory(
            Environment.DIRECTORY_PICTURES);


Also, on serverside. For example, if you use xampp on windows..
To make the current code work you have to have structure:
php_file.php  -- or watever the name was
uploads\ -- I think this was the name of the folder


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.