Image_mover.php 460 B

12345678910111213141516171819202122
  1. <?php
  2. include '../auth.php';
  3. ?>
  4. <?php
  5. //Image Processing System
  6. if(!isset($_POST["dir"]) || !isset($_POST["files"])){
  7. die('FAILED');
  8. }
  9. $files = explode(",",$_POST['files']);
  10. $target = $_POST['dir'];
  11. $opr = $_POST['opr'];
  12. foreach ($files as $file){
  13. if ($opr == 1 || $opr == 2){
  14. //No idea why php rename does the moving job =w=
  15. rename($file, str_replace(pathinfo($file)['dirname'],$target,$file));
  16. }
  17. if ($opr == 3){
  18. unlink($file);
  19. }
  20. }
  21. echo 'DONE';
  22. ?>