summaryrefslogtreecommitdiffstats
path: root/files/ajax/delete.php
blob: 113476f0254e053f1cbd4c669a4a03b615bd2b08 (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"];

// Delete
if( OC_FILES::delete( $dir, $file )){
	echo json_encode( array( "status" => "success", "data" => array( "dir" => $dir, "file" => $file )));
}
else{
	echo json_encode( array( "status" => "error", "data" => array( "message" => "Unable to delete file" )));
}

?>