summaryrefslogtreecommitdiffstats
path: root/files/ajax/move.php
blob: 4224cbce6d0b4f9d282b98cd9d8ae0de99581ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

// Init owncloud
require_once('../../lib/base.php');

// We send json data
header( "Content-Type: application/jsonrequest" );

// Check if we are a user
if( !OC_User::isLoggedIn()){
	echo json_encode( array( "status" => "error", "data" => array( "message" => "Authentication error" )));
	exit();
}

// Get data
$dir = $_GET["dir"];
$file = $_GET["file"];
$target = $_GET["target"];


if(OC_Files::move($dir,$file,$target,$file)){
	echo json_encode( array( "status" => 'success', "data" => array( "dir" => $dir, "files" => $file )));
}else{
	echo json_encode( array( "status" => 'error', "data" => array( "message" => "Could move $file" )));
}

?>