rename.php 442 B

12345678910111213141516171819202122
  1. <?php
  2. // Init owncloud
  3. OCP\JSON::checkLoggedIn();
  4. // Get data
  5. $dir = stripslashes($_GET["dir"]);
  6. $file = stripslashes($_GET["file"]);
  7. $newname = stripslashes($_GET["newname"]);
  8. // Delete
  9. if( OC_Files::move( $dir, $file, $dir, $newname )) {
  10. OCP\JSON::success(array("data" => array( "dir" => $dir, "file" => $file, "newname" => $newname )));
  11. }
  12. else{
  13. OCP\JSON::error(array("data" => array( "message" => "Unable to rename file" )));
  14. }
  15. ?>