diff options
author | Robin Appelman <icewind1991@gmail.com> | 2011-10-23 11:40:40 +0200 |
---|---|---|
committer | Robin Appelman <icewind1991@gmail.com> | 2011-10-23 11:40:40 +0200 |
commit | d46288b0abea28a4e0184f6720e990a05d5f19a9 (patch) | |
tree | eb67d6849ff6239381f72fcca2b4c84da3d43ae7 /files/ajax/newfile.php | |
parent | 122fa190c684d953c1f11930109ca6644fde485c (diff) | |
download | nextcloud-server-d46288b0abea28a4e0184f6720e990a05d5f19a9.tar.gz nextcloud-server-d46288b0abea28a4e0184f6720e990a05d5f19a9.zip |
'New' button, needs some css work
Diffstat (limited to 'files/ajax/newfile.php')
-rw-r--r-- | files/ajax/newfile.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/files/ajax/newfile.php b/files/ajax/newfile.php new file mode 100644 index 00000000000..5c4f49a3675 --- /dev/null +++ b/files/ajax/newfile.php @@ -0,0 +1,27 @@ +<?php + +// Init owncloud +require_once('../../lib/base.php'); + +OC_JSON::checkLoggedIn(); + +// Get the params +$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; +$filename = isset( $_GET['filename'] ) ? $_GET['filename'] : ''; +$content = isset( $_GET['content'] ) ? $_GET['content'] : ''; + +if($filename == '') { + OC_JSON::error(array("data" => array( "message" => "Empty Filename" ))); + exit(); +} + +if(OC_Files::newFile($dir, $filename, 'file')) { + if($content){ + OC_Filesystem::file_put_contents($dir.'/'.$filename,$content); + } + OC_JSON::success(array("data" => array('content'=>$content))); + exit(); +} + + +OC_JSON::error(array("data" => array( "message" => "Error when creating the file" )));
\ No newline at end of file |