|
Project Information
Members
Links
|
ShareFile API PHP is a standalone PHP library which simplify access to ShareFile REST API. Features:
ShareFile online file sharing serviceShareFile allows you to create a custom-branded, password-protected area where you can exchange business files with clients easily, securely, and professionally. Whether you deal with files that are simply too large to transfer by email, need secure file transfer, or just need a collaboration space where project-related files can be posted, ShareFile can provide a solution for you. For more information please visit http://www.sharefile.com. For more details about ShareFile REST API please visit http://api.sharefile.com/rest.aspx Wiki Pages
How to use:Use of CodeIgniter library// Load library
$config['secure'] = true;
$this->load->library('ShareFile_ci', $config);
// Create connection object
$connection = $this->sharefile_ci->open('my-subdomain', 'my@email.com', 'mypassword');
if (isset($connection) && ! $this->sharefile_ci->is_error()) {
// Upload file
$filename = 'test.txt';
$content = 'This is a test text file';
$folder = '/';
$unzip = false;
$overwrite = true;
$details = 'Test file details';
$response = $connection->file_upload($filename, $content, $folder, $unzip, $overwrite, $details);
if ($connection->is_error()) {
echo 'ERROR: ' . $connection->get_error();
}
else {
echo "File ID is {$response->value->id}";
}
}
else {
echo $this->sharefile_ci->get_error();
}Use of native PHP libraryrequire_once('ShareFile.php');
// Create ShareFile object
$secure = true;
$sharefile = new Sharefile($secure);
// Create connection object
$connection = $sharefile->open('my-subdomain', 'my@email.com', 'mypassword');
if (isset($connection) && ! $sharefile->is_error()) {
// Upload file
$filename = 'test.txt';
$content = 'This is a test text file';
$folder = '/';
$unzip = false;
$overwrite = true;
$details = 'Test file details';
$response = $connection->file_upload($filename, $content, $folder, $unzip, $overwrite, $details);
if ($connection->is_error()) {
echo 'ERROR: ' . $connection->get_error();
}
else {
echo "File ID is {$response->value->id}";
}
}
else {
echo $sharefile->get_error();
}
|