Dropzone.js和覆盖消息

时间:2016-10-17 18:03:36

标签: dropzone.js

我有完整的代码来使用Dropzone.js库上传文件。然后我试图显示一条消息,显示是或否按钮来覆盖现有文件。

我能够检测到现有文件并显示重复的消息,但是我无法使用下面的代码创建通过“是/否”按钮选择来抑制覆盖的功能

//check for duplicates
if (!is_file($targetFile)) {
    move_uploaded_file($tempFile,$targetFile);

    $html_content="";

}
//if so rename as .datestamp.bak
else {
    $old = $targetFile;
    $new = $targetFile.".".date('YmdHis').'.bak';
    rename($old,$new);

    $html_content="Duplicate document detected.";

    move_uploaded_file($tempFile,$targetFile);  
}

    $json_array=array('html_content'=>$html_content);

    header('Content-type: text/json');
    header('Content-type: application/json');
    echo json_encode($json_array)

我的问题是,dropzone.js能否提供这种功能(需要通知用户该文件已经存在并且将通过执行选择被新的文件覆盖)或者我需要查看某些内容或者像通过jQuery AJAX调用扩展该库?

0 个答案:

没有答案