summaryrefslogtreecommitdiffstats
path: root/files/ajax/newfolder.php
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2011-04-17 17:49:56 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2011-04-17 17:49:56 +0200
commit9b26cb0bfb6c6b3aab03eb3320a9a9917786f1ac (patch)
tree3f0d533cc60706c8a5fddcd237875cb5b82c7cce /files/ajax/newfolder.php
parent60b682561254797330110693705b2c36dd7928a4 (diff)
downloadnextcloud-server-9b26cb0bfb6c6b3aab03eb3320a9a9917786f1ac.tar.gz
nextcloud-server-9b26cb0bfb6c6b3aab03eb3320a9a9917786f1ac.zip
implement "new folder" function
Diffstat (limited to 'files/ajax/newfolder.php')
-rw-r--r--files/ajax/newfolder.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/files/ajax/newfolder.php b/files/ajax/newfolder.php
new file mode 100644
index 00000000000..988e7f04012
--- /dev/null
+++ b/files/ajax/newfolder.php
@@ -0,0 +1,29 @@
+<?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 the params
+$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$foldername = isset( $_GET['foldername'] ) ? $_GET['foldername'] : '';
+
+if($foldername == '') {
+ echo json_encode( array( "status" => "error", "data" => array( "message" => "Empty Foldername" )));
+ exit();
+}
+error_log('try to create ' . $foldername . ' in ' . $dir);
+if(OC_FILES::newFile($dir, $foldername, 'dir')) {
+ echo json_encode( array( "status" => "success", "data" => array()));
+ exit();
+}
+
+echo json_encode( array( "status" => "error", "data" => array( "message" => "Error when creating the folder" ))); \ No newline at end of file