function dropbox_client_upload_form_submit in Dropbox Client 7.2
Same name and namespace in other branches
- 7.4 dropbox_client.module \dropbox_client_upload_form_submit()
- 7 dropbox_client.module \dropbox_client_upload_form_submit()
- 7.3 dropbox_client.module \dropbox_client_upload_form_submit()
File
- ./
dropbox_client.module, line 466
Code
function dropbox_client_upload_form_submit($form, &$form_state) {
global $user;
$dropbox = dropbox_client_get_client();
//Process files
$uploads_dir = dirname($_FILES['files']["tmp_name"]['upload']);
$tmp_name = $_FILES['files']["tmp_name"]['upload'];
$name = $_FILES['files']["name"]['upload'];
$filename = "{$uploads_dir}/{$name}";
move_uploaded_file($tmp_name, $filename);
$dpath = isset($_GET['dpath']) ? $_GET['dpath'] : '/';
$result = $dropbox
->add($dpath, $filename);
if (property_exists($result, 'error')) {
drupal_set_message($result->error);
}
else {
drupal_goto('/', array(
'query' => array(
'dpath' => $dpath,
),
));
}
}