in my project, I have downloaded 17111611185.zip file with ajax.
After downloading the zip file, I want to delete this file from my linux server.
So after window.location=data, ajax is called again for passing 17111611185.zip to server.
$.ajax({
type:'POST',
data:{files:files},
url:'oat.php',
success:function(data){// data is 17111611185.zip
window.location=data;
//2017-12-19delete zip file
$.ajax({
type:'POST',
data:{delFile:data},
url:'delFileoat.php',
success:function(data){
}
});
}
});
The delFileoat.php code is:
<?php
if(isset($_POST['delFile'])){
$delFile=$_POST['delFile'];
unlink($delFile);
}
?>
But unlucky, the return message is 17111611185.zip can not be found. And delete progress is fail.
It seems nothing wrong. When I just download file without deleteing, like:
$.ajax({
type:'POST',
data:{files:files},
url:'oat.php',
success:function(data){// data is 17111611185.zip
window.location=data;
}
});
It works OK. But fail, when deleting code is added.
我认为上传的文件位于tmp文件夹中,可以通过
ini_get('upload_tmp_dir');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.