I had developed a website for my client and now the mobile team is developing the android app for them. For that, I created some API to get the data which will be initiated by the android developers.
Now, I need to upload the file(video or document) using the APIs. Link to my database and file to my specific folder.
Example API which I used to get the product details
http://xxxxxxxx.com/xxxxxx/api/doctor_pitch_details?email=mahesh#gmail.com&password=123456789&product=22
can anyone help me how to do it.
Don't use get use multipart and tell your android team to send data in multipart form so you can get a file at your end get file like
$user_photo = $_FILES['faile_param_name']['name'];
Related
I am developing E-Store App I want to upload the cart data which i am getting from php server to recycler view. I want to upload the whole recycler view to the database using Retrofit 2.0 and rest API.i want to know how to do it or there is another method to do it better
You can use Room from Android Architecture Components (Jetpack) for storing data in local database.
Some Info: https://developer.android.com/training/data-storage/room/index.html
Release notes: https://developer.android.com/jetpack/androidx/releases/room
I am writing API which is help developers to create upload functionality which works like below:
First Developer set API SECRET and create input tag and give some classes.Then he calls javascript libs for my API.So this API make this input beutiful and create some functions like this: when someone click on choose Image button and if input changed, it will send this image to my server and return image url.So developer will be able to allow user to upload their images to his API account.
But problem is if my server doesn't contain header('Access-Control-Allow-Origin: *'); it will return error.How can I solve this?
Is there a way to scan a UPC or QR code from a mobile website (html5 + php)? I'm looking for a solution that would work on both iPhone and Android devices. From what I have found, it seems that there are possibly some ways to do this on an Android by calling an installed Scanner app and using a passback URL that would pass the data back to the web app. Any help is much appreciated!
For Android, I would recommend using the zxing barcode library. It's open source, and I am pretty sure it is what Google Goggles is using:
http://code.google.com/p/zxing/
Then, you just load your website/application via a webview in Android:
http://developer.android.com/guide/webapps/webview.html
You can attach an API to the Webview that allows you to call Java code with javascript:
http://developer.android.com/guide/webapps/webview.html#BindingJavaScript
I can't help much on the iOS side. Though, I do know they have a webview available and you can probably find an open source barcode scanning library to use.
Once you write the webview "wrapper", future updates can be mostly delivered via the web since the user will just be loading your webpage, even if they think the app is native.
I did it in iOS (I can't answer the android portion) using a set of plugins, plus I inserted my own additions to make it a 1-stop setup.
unzip the attached zip file into your project ( https://github.com/chwagssd/qr/archive/master.zip )
point to <script src="path/to/decoder.js"><script>
Create a file input in your HTML page that has an id, say "xxx"
<input type="file" id="xxxx">
Then tell the page on load to QRIfy your field! Make sure to include your callback function, which will be called with a single argument (the FULL TEXT that was scanned): QRIfy('qrCode', onQrCode);//where qrCode is the id of your
<input type="file" id="xxxx">
I have setup a GIT repo here, grab the code (you can download the zip and put it in your javascript folder)
https://github.com/chwagssd/qr
I'm new to Android and would like to ask is it possible to save the files (incl. image, text etc) created within a app directly to the php server? Without saving it in any internal or external storage like SD card?
This is due to users are not allowed to access to the data once they offline.Users shall not kept anything to their personal device other than accessing it online by login in.
I have read through the passage of Data Storage in Android developer website. What was mentioned there is just the ways for data storage. Web server as the last options without having any examples.
Please advise and give a snippet if possible.
Another questions will be, in such a situation(save in server without saving in SD card). Any idea on how to keep the created data temporary if let's say the internet connection is down? And I do not wish to lost any data?
Please give some suggestion, if you have any for the problem.
You can definitely save data to a server and not ever write it to the local disk: Google is your friend and will provide examples such as this if you search for android POST http.
No exampele because nothiong is android specific here .
create webservice to store file send the data to webservices from device . in case of images send its ByteStream . example is here .
I am developing an iPhone app, which now can update Twitter account with GPS coordinates in real-time, by the Twitter API link: http://username:password#twitter.com/statuses/update.xml , and I am looking at how to make my own database to accept updates from iPhone, via a similar API page.
It seems a .php page can serve as the API, and MySQL can serve as the database.
What are the good ways of doing it? Any template code and tutorial please?
Try one of these:
http://www.webresourcesdepot.com/how-to-create-an-api-10-tutorials/
Thanks for the answer. I found the php page just need code like
$userid=$_POST["userid"];
$companyid=$_POST["companyid"];
$phoneid=$_POST["phoneid"];
to receive POST from the iphone app.