我使用Fine Uploader版本:5.0.8
1)我选择文件1.png
2)PHP脚本使用新名称fdba4551.png
重命名和上传 3)我想删除文件,但不知道如何传递参数unlink($UploadDir.$_POST['??????????']);
我无法删除文件fdba4551.png
我的PHP
if($method == 'POST')
{
if(move_uploaded_file($TempName, $PatchNewFile))//$PatchNewFile = uploads/fdba4551.png
{
$return = array('success'=>true,'uuid'=>$uuid,'uploadName'=>$NewFile);//$NewFile = fdba4551.png
echo json_encode($return);
}
}
elseif($method == 'DELETE')
{
unlink($UploadDir.$_POST['??????????']);//?????????????
}
我的java脚本
<script type="text/javascript">
$(document).ready(function()
{
$('#upl').fineUploader({
debug:true,
deleteFile:{
enabled:true,method:'POST',endpoint:'upload/'
},
request:{
endpoint:'upload/'
},
callbacks:{
onComplete:function(id, name, response)
{
$('#file').append('<input type="hidden" name="load_file[]" value="'+response.uploadName+'" id="'+id+'">');
},
onDelete:function(id)
{
$('#file #'+id).remove();
}
},
validation:{allowedExtensions:['jpeg','jpg','png','gif'],acceptFiles:'image/jpeg,image/png,image/gif',itemLimit:10,sizeLimit:5*1024*1024}
});
});
</script>
答案 0 :(得分:0)
如delete file endpoint handler section of the docs:
中所述