upload_file()
Upload a file
upload()
Upload a file to the cloud using a simple file object.
Parameters
$file
File object
Object containing the file details. Same as file object in $_FILES.
$upload_folder_id
string
ID of the upload folder.
$description
string
Description for the file.
$overwrite
bool
Overwrite an existing file with the same name? If false, the file will be renamed.
Return
$node
CachedNode
The object for the uploaded file.
Usage
WPCP_ONEDRIVE_API::set_account_by_id('8c9bacda0-d8d8-4b22-b634-7b5281687575');
WPCP_ONEDRIVE_API::set_drive_by_id('b!DlaHWskCed_MIid3KpJH5Lbatf9HsdXBAZH5YcvPAbMhJUKzTJyzgvXZYpBS');
// File location on server
$file_path = '/absolute/path/to/file/on/server.ext';
// Create File object
$file = (object) [
'tmp_path' => $file_path,
'type' => mime_content_type($file_path),
'name' => 'filename.ext',
'size' => filesize($file_path),
];
$entry = WPCP_ONEDRIVE_API::upload_file($file, '01EXLSWHRCD7RDL3HX65BK5X3ULXLWSICN', 'A simple description', false);Parameters
$file
File object
Object containing the file details. Same as file object in $_FILES.
$upload_folder_id
string
ID of the upload folder.
$description
string
Description for the file.
$overwrite
bool
Overwrite an existing file with the same name? If false, the file will be renamed.
Return
$node
CachedNode
The object for the uploaded file.
Usage
WPCP_GDRIVE_API::set_account_by_id('201096615285735764133')
// File location on server
$file_path = '/absolute/path/to/file/on/server.ext';
// Create File object
$file = (object) [
'tmp_path' => $file_path,
'type' => mime_content_type($file_path),
'name' => 'filename.ext',
'size' => filesize($file_path),
];
$entry = WPCP_GDRIVE_API::upload_file($file, '1FCYkOJb150I8nl8DE92YIXWaB0J7VOk5', 'A simple description', false);Parameters
$file
File object
Object containing the file details. Same as file object in $_FILES.
$dropbox_path
string
The upload PATH on Dropbox containing the filename /path/to/folder/filename.ext
Return
$entry
Entry
The object for the uploaded file.
Usage
WPCP_DROPBOX_API::set_account_by_id('dbid:AADSy6JxzbgqCs4A43CAAAfO9xvZwpcsLU');
// File location on server
$file_path = '/absolute/path/to/file/on/server.ext';
// Create File object
$file = (object) [
'tmp_path' => $file_path,
'type' => mime_content_type($file_path),
'name' => 'filename.ext',
'size' => filesize($file_path),
];
$entry = WPCP_DROPBOX_API::upload_file($file, '/Documents/filename.ext')Parameters
$file
File object
Object containing the file details. Same as file object in $_FILES.
$upload_folder_id
string
ID of the upload folder.
$description
string
Description for the file.
$overwrite
bool
Overwrite an existing file with the same name? If false, the file will be renamed.
Return
$node
CachedNode
The object for the uploaded file.
Usage
WPCP_BOX_API::set_account_by_id('29232154182');
// File location on server
$file_path = '/absolute/path/to/file/on/server.ext';
// Create File object
$file = (object) [
'tmp_path' => $file_path,
'type' => mime_content_type($file_path),
'name' => 'filename.ext',
'size' => filesize($file_path),
];
$entry = WPCP_BOX_API::upload_file($file, '511426724354', 'A simple description', false);Last updated