您需要修改代码如下:
if(move_uploaded_file($pic['tmp_name'], $upload_dir.$pic['name'])){
//do logic to generate folder ID
exit_status('File was uploaded successfuly!', $folder_id);
}
然后修改exit_status()
函数:
function exit_status($str, $folder_id){
echo json_encode(array('status'=>$str, 'folder_id' => $folder_id));
exit;
}
然后,修改方法的uploadFinished
功能dropbox.filedrop
:
uploadFinished:function(i,file,response){
$.data(file).addClass('done');
// response is the JSON object that post_file.php returns
response.folder_id now contains the $folder_id generated on the server
}