NullPointerException
NullPointerException

Reputation: 37635

How to upload images into my remote server with PHP?

I have an android app, that connectos to the remote database with PHP+json

but now, i have to store photos of the users on the remote server. I need to do it storing the URL of the uploaded photo in a row of the USER TABLE. That is not the problem. The problem is that i have not idea about with a given path of a photo, how to upload it into a dir of the remote server of my app?

as i know, i need two things, a function that connects with a PHP and gives to the PHP the photo, and a PHP that receives the photo and uploads it into a dir of the remote database.

Well....¿can someone help me to do it?

I checked a lot of tutorials of doing this with PHP but i can't find a easy one that how to do it with android+php+mysql, all i am finding is too hard for me.

can someone give me the code i need to do it?

thanks

EDIT:

there does not exist a simple function and a simple PHP code that does it? Simple ones, the examples you are giving me are very hard for my skills with this and i can't apply to my android app and my remote server

Upvotes: 0

Views: 2450

Answers (2)

dave.c
dave.c

Reputation: 10908

For the Android part, its just straight Java, and there are loads of examples of using HttpClient to perform file uploads.

Upvotes: 1

Francesco Laurita
Francesco Laurita

Reputation: 23552

For the PHP side: http://it.php.net/manual/en/features.file-upload.php (there are a lot of sample)

For the Android side: this article explains hot to use DefaultHttpClient for make and upload via HTTP

Upvotes: 1

Related Questions