The personal cloud API is a small Lumen application that allows file uploads (excluding disallowed extensions). Files are stored in a private section of the application, and indexed by the database.
To begin using the Personal Cloud API, do the following:
- Clone the repository to your own server
- Ensure proper write permissions on
storage/app
which files are kept. - Set up your
.env
file to point to your database of choice (standard Laravel database drivers are included in Lumen). - Run
composer install
or whatever you have composer set as to install dependences (only the core dependencies for Lumen are required at present) - Run
php artisan migrate
and ensure you get a positive result - Test out file uploads at
servername/upload
Once you’re all set, you can send a multipart/form-data
POST
request to /api/v1/file
. The endpoint only accepts one parameter, file
which should be the actual file. Upon success, you will receive a JSON response with a location
string node with the publicly accessible URL of the file.
Hitting that publicly accessible URL will return the file, with the original filename as when it was uploaded.
To restrict certain filetypes, there is a disallowedExtensions
array belonging to the FilesController
class. Those extensions will result in an HTTP error 415.
You can customize the messaging of the different type of errors by checking the __constructor
of FilesController
.
If the file is too large, or other PHP-related configuration issues, you will get a Lumen-provided 500
error and a rather vulgar error message (you’re welcome…). Check your php.ini
file for common snafus like upload_max_filesize
and post_max_size
.
The API is presently unlicensed. Any use is at your own risk.
Coming soon… Android Sample App, iOS Sample App, React Sample App. And hey, maybe Angular too.