You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud-server/apps/files/ajax/newfolder.php

28 lines
707 B

<?php
// Init owncloud
13 years ago
OCP\JSON::checkLoggedIn();
13 years ago
OCP\JSON::callCheck();
// Get the params
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
$foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : '';
if(trim($foldername) == '') {
13 years ago
OCP\JSON::error(array("data" => array( "message" => "Empty Foldername" )));
exit();
}
if(strpos($foldername,'/')!==false){
OCP\JSON::error(array("data" => array( "message" => "Invalid Foldername" )));
exit();
}
if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) {
13 years ago
OCP\JSON::success(array("data" => array()));
exit();
}
13 years ago
OCP\JSON::error(array("data" => array( "message" => "Error when creating the folder" )));