upload image from android UI to php server side api - php

i got two questions.
1) i want to upload image into php server and the front end will be android. and i want all processing to be done by php api like checking image and name extension and even error checking .
All the tutorials that i surfed has done in such way that most of the processing is done in android and only for storing uses php api. so any suggestion which supports above requirement will be of great help.
2) $_FILES["fileContents"]["type"] this line in php api is directly used with android uploadimage . i know that it initates file browse option but how to pass parameter value ['fileContents'] from android code.
thanks

Related

turning jquery mobile and php mysql into apk file

I made an app using jquery mobile, php and mysql and now I'm trying to convert into .apk file using phonegap for desktop.
But I have a problem with my php code because it doesn't work, phonegap doesn't recognize php code.
Is there a way can do it to convert both jquery mobile code and php & mysql into .apk?
I will post the whole code if it's necessarily or another way to do this, please help!
Unfortunately not.
You would have to separate your server-side and client-side code.
HTML & jQuery Mobile would be your client, which you could turn into your app.
PHP & mySQL would be your server, which you could not put in your app.
You would then communicate between the client and the server by calling Ajax in client code, you might also like to use a framework like CakePHP on the server.
Good luck!!

how to make server who receive file from android app?

I am android developer and zero at back end process. Whats stuff/tools require for making a server/website that receives files from android app. I listen somewhere that php code is required as backend on server side. Is is true?
hoping for detailed explanation. Sorry for my english.
Thanks.
need php file for coonecting with database.use phpmyadmin(xampp)
tool for creating database.then create phpfile n post on server or localhost. after that use url in android.like our php link is localhost:80/phpproj/trial.php
and pass value to database using asyctask method.

3-tier file upload architecture (Browser/ PHP/ API)

We're currently facing a design challenge about dealing with large (>30 MB) file uploads. Our system is currently as follows:
Browser <---AJAX---> PHP <---OAUTH---> REST API
PHP and API are on different servers/domains.
Uploading a file from browser to PHP and then from PHP to API sounds like a waste of bandwidth to me.
So the idea we had in mind is to use the following sequence:
PHP request upload-URL from the API
API creates nonce and sends it back as upload-URL
Browser uploads the file directly to the API using the upload-URL.
So we only transfer the file data once.
Would there be anything wrong with this?
Thanks,
pepijn
If the PHP needs no further processing to do with the file, then it should be fine.

is it possible to upload an image with only jquery with out using any php

i am trying to upload an image with Ajax/jquery without refreshing and also without using any php in back-end.
i searched alot but all are using php at back-end, my requirement is not to use php.
http://www.9lessons.info/2011/08/ajax-image-upload-without-refreshing.html
http://dondedeportes.es/uploader-previewer/
if not possible without php . please suggest me some alternatives .
No, it's not possible to upload an image without some kind of backend to process the upload.
You can't upload the image to the server without server-side processing.
If your goal is just to show the image in the page, without uploading it to the server (perhaps as a preview), that's possible on newer browsers via a combination of the File API and a data: URI. The File API gives you client-side access to the file a user identifies, including the ability to read its contents; and a data: URI lets you put an image on the page using the data from that image file.
What kind of server are you using? If it supports Webdav, you could use a Javascript Webdav-Client. But for this, the server has to be configured.

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
For the Android part, its just straight Java, and there are loads of examples of using HttpClient to perform file uploads.
How to upload a file using Java HttpClient library working with PHP - strange problem
google search
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

Categories