I have a controller to upload image to my web server. I want to upload that image to dropbox as well during the process. how would I do it?
This is my simple upload.php controller:
function index() {
// get the binary data
$file = file_get_contents("php://input");
// prepare new name for upload image
$name =rand().time().'jpg';
$path = site_url('photo');
// save to server directory
file_put_contents($path.$name, $file);
// save the name and id of the post to post photo table
$input = array( 'name' => $name,
'post_id'=> $id
);
$this->db->insert('post_photo', $input);
}