DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • Front-End: Cache Strategies You Should Know
  • Using Render Log Streams to Log to Papertrail
  • DevOps Midwest: A Community Event Full of DevSecOps Best Practices
  • Incident Response Guide

Trending

  • Front-End: Cache Strategies You Should Know
  • Using Render Log Streams to Log to Papertrail
  • DevOps Midwest: A Community Event Full of DevSecOps Best Practices
  • Incident Response Guide
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How to Upload Files From a Mobile App to a Cloud Database

How to Upload Files From a Mobile App to a Cloud Database

Max Katz user avatar by
Max Katz
·
Apr. 09, 15 · Interview
Like (0)
Save
Tweet
Share
5.92K Views

Join the DZone community and get the full member experience.

Join For Free

Mobile developers often face the need to upload binary files, such as images, to the database. For example, this could happen in an app like Instagram, where a user takes photos with the device’s camera and then publishes it to their followers. Of course, all the data — including images — should be stored in the database, so the user can sign in from any device and see his or or her feed.

Another possible case for uploading images is sending an MMS (multimedia message) from your app, which can be done via the Twilio API. Twilio accepts a direct URL to an image. A user takes a picture with the device and uploads it to the Appery.io database. Then, a direct image URL is passed to the Twilio API.

In Appery.io, there are three ways to upload files to the database :

  • Via Web API (this approach uses only the browser API).
  • Via Cordova file-transfer.
  • Via the Input component and JavaScript helper (It’s also possible to upload multiple files via the Input component, see this tutorial for more).

We’ve created a plug-in for the first two of these, and, with it, you can quickly implement file uploading in your mobile Appery.io app. It consists of two pages – cordovaupload and webupload. The cordovaupload uses the Cordova file-transfer plug-in. To make it work, the app has to run on the device or via the Appery.io Tester app.

The webupload page uses the browser FormData API to upload a file. This approach can be used to test the app in the browser, which is faster than on the device without having to take a picture each time. The Web API can be also used to upload images taken via the camera on the device.

A quick note about configuring the plugin: the Appery.io database requires a sessionTokenfor uploading files to the database. To make the plugin simpler to use, it uses the Master Key. So, to configure this plugin, you should provide the ID of the database that will be used to store files and the Master Key instead of sessionToken.

However, please keep in mind that for security reasons, we recommend you use sessionToken instead of Master Key. You can learn how to implement user authentication and registration with Appery.io here.

This plug-in is configured out-of-the-box to work with the Appery.io database, but it can be modified to work with any other API provider that allows file upload. You will need to change the upload REST API and update any parameters.

As usual, we’ve prepared a detailed tutorial for this plug-in, which you can find here.

If you have any problems with this plug-in or with file uploading in Appery.io, contact our support and they will help you right away.

mobile app Cloud database Upload

Published at DZone with permission of Max Katz, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Front-End: Cache Strategies You Should Know
  • Using Render Log Streams to Log to Papertrail
  • DevOps Midwest: A Community Event Full of DevSecOps Best Practices
  • Incident Response Guide

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: