S3DB - Simple and Sloppy Semantic Database
The S3DB API can also be used for uploading files into S3DB. This process involves three steps:
- Providing S3DB with the key and a filename in order to receive a temporary filekey that will identify each fragment
- Uploading the file to a temporary folder by fragments encoded in base64
- Inserting the file as a statement
Uploading large files into S3DB becomes possible using the S3DB module "uploads.php". Files can be sent to this module in packages of base64 encoded string. The file uploading requires the following sequence of steps:
- Provide uploads.php with a valid S3DB key and a filename (if provided, filesize will also be used). Both parameters are provided to "uploads.php" using the GET method.
Ex: http://localhost/s3db1.0/uploads.php?key=Y1F2mHOgGSdJjqC&filename=airplane.gif&filesize=9747
- Use the filekey to upload the fragments, indicating in each case the order of the fragment being uploaded and the total number of fragments.
If the fragments were encoded individually use encode=2 (encode=1 or empty encode expect the entire file to have been encoded at once)
Ex: http://localhost/s3db1.0/uploads.php?filekey=RXvYe0xzWoKr&fragNr=1/4&encode=1 &fileStr=d2VyZSB5b3Ugc21hcnQgZW5vdWdoIHRvIGRlY29kZSB0aGlzIHN0cmluZyBhbmQgc2VlIHdoYXQgaXQgc2F5cz8gOy0pIA==
Note: The variables filekey, fragNr, encode and fileStr can also be sent using a POST instead of a GET
- Once all the fragments have been uploaded, insert the file on S3DB using the S3QL insert file query (see Insert queries). If this step is not completed, the temporary uploaded file will be deleted.
Previous/Table of Contents
Email: helenadeus@gmail.com, almeida.jonas@gmail.com
|