API Documentation


In order to access the API interface, you must have a working API key. You can get your API key here . To get your API key you must have a premium or free account.

Get file information:

You must pass your API key and the files ID via post or get

Example Get:
http://file-storm.com/api/info.php?api_key=1234567890&file_id=1234567890

Output:
Array ( [file_id] => QCRssxD12y0260423 [file_name] => myFile.rar [file_type] => application/octet-stream [file_size] => 1434112 )


Uploading Files:

The following code is just an example, you can achive the same affect in other programming languages.

Example:
class Uploader { var $filePath; var $uploadURL; var $formFileVariableName; var $postParams = array (); function Uploader($filePath, $uploadURL, $formFileVariableName, $otherParams = false) { $this->filePath = $filePath; $this->uploadURL = $uploadURL; if(is_array($otherParams) && $otherParams != false) { foreach($otherParams as $fieldName => $fieldValue) { $this->postParams[$fieldName] = $fieldValue; } } $this->postParams[$formFileVariableName] = "@" . $filePath; } function UploadFile() { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $this->uploadURL); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this->postParams); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $postResult = curl_exec($ch); if (curl_errno($ch)) { print curl_error($ch); print "Unable to upload file."; exit(); } curl_close($ch); return $postResult; } } $upload_server = "http://file-storm.com/api/upload.php"; $upload = new Uploader('file.rar', $upload_server, 'file', array('api_key' => 'YOUR_API_KEY')); $result = $upload->UploadFile(); if(preg_match("/upload_failed/", $result)){ echo "Upload failed."; } if(preg_match("/invalid_api/", $result)){ echo "Invalid API Code."; } if(preg_match("/upload_success/", $result)){ echo $result; }

Output:
upload_success
http://file-storm.com/files/123456789/myfile.rar.html
http://file-storm.com/delete/123456789/123456789/myfile.rar.html

Sponsor