O'Reilly logo

Mastering PhoneGap Mobile Application Development by Kerri Shotts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Receiving files using PHP on a server

Before we can upload a file to a server, we need to have something on the server that can receive and process the file. At a minimum, this process writes the file to a specific location on the server, but there's usually a little bit more going on. Usually, the request is checked to make sure something fishy isn't going on (such as a file is too large or of the wrong type). Then, the file is almost always renamed to prevent naming collisions. After this, it's up to you: you could run a virus scan on the file, resize it (if it's an image), upload it to a backend database, send it to another server, and so on.

Note

The snippets in this section are located at snippets/09/ex2-uploading-files in the code package ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required