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/files/ajax/newfolder.php

29 lines
886 B

<?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" )));