| Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64 Path : /home/u901718425/public_html/php/ |
| Current File : /home/u901718425/public_html/php/file_crud.php |
<?php
if($_POST){
switch($_POST['opration']){
case 'rename':
if(!file_exists($_POST['new_path'])){
rename($_POST['path'],$_POST['new_path']);
if(file_exists($_POST['new_path'])){
$out[0] = 'success';
$out[1] = 'file is rename successfully';
}else{
$out[0] = 'error';
$out[1] = 'file technical error is rename file';
}
}else{
$out[0] = 'error';
$out[1] = 'file from this name is already exist';
}
break;
case 'delete':
unlink($target_file);
if(file_exists($_POST['path'])){
$out[0] = 'success';
$out[1] = 'file is deleted successfully';
}else{
$out[0] = 'error';
$out[1] = 'file technical error is deleted file';
}
break;
case 'move':
rename($_POST['path'],$_POST['new_path']);
if(file_exists($_POST['new_path'])){
$out[0] = 'success';
$out[1] = 'file is moved successfully';
}else{
$out[0] = 'error';
$out[1] = 'file technical error is move file';
}
break;
case 'copy':
copy($_POST['path'],$_POST['new_path']);
if(file_exists($_POST['new_path'])){
$out[0] = 'success';
$out[1] = 'file is Copy successfully';
}else{
$out[0] = 'error';
$out[1] = 'file technical error is Copy file';
}
break;
}
echo json_encode($out);
}