Does someone know how it is possible to upload multiple files with the dropbox client module for drupal 7?
It would be nice if it could be integrated with plupload.
Also i would like to know how i can predefine the filetypes users can upload?
I'm a n00b in php, can someone give me some tips or solutions?
Here is the part of the upload funktion in the dropbox client module.
function dropbox_client_upload_form( $form, &$form_state ) {
$form[ 'upload' ] = array(
'#title' => t('Upload file'),
'#type' => 'file',
'#size' => 20,
);
$form[ 'submit' ] = array(
'#type' => 'submit',
'#value' => t( 'Upload' ),
);
return $form;
}
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( $_GET['q'], array( 'query' => array( 'dpath' => $dpath ) ) );
}
}
Thank you!
Best regards, meckl