diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-17 17:49:56 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2011-04-17 17:49:56 +0200 |
commit | 9b26cb0bfb6c6b3aab03eb3320a9a9917786f1ac (patch) | |
tree | 3f0d533cc60706c8a5fddcd237875cb5b82c7cce /files/ajax/newfolder.php | |
parent | 60b682561254797330110693705b2c36dd7928a4 (diff) | |
download | nextcloud-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.php | 29 |
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 |