4include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
5include_once(
"./Services/JSON/classes/class.ilJsonUtil.php");
44 $ilTabs =
$DIC[
'ilTabs'];
46 $ilTabs->activateTab(
"content");
48 echo $this->form->getHTML();
52 $options->dropZone =
"#ilFileUploadDropZone_1";
53 $options->fileInput =
"#ilFileUploadInput_1";
54 $options->submitButton =
"uploadFiles";
55 $options->cancelButton =
"cancelAll";
56 $options->dropArea =
"#ilFileUploadDropArea_1";
57 $options->fileList =
"#ilFileUploadList_1";
58 $options->fileSelectButton =
"#ilFileUploadFileSelect_1";
59 echo
"<script language='javascript' type='text/javascript'>var fileUpload1 = new ilFileUpload(1, " .
ilJsonUtil::encode(
$options) .
");</script>";
72 include_once(
"./Services/Form/classes/class.ilDragDropFileInputGUI.php");
73 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
76 $this->form->setId(
"upload");
77 $this->form->setMultipart(
true);
78 $this->form->setHideLabels();
81 $file->setRequired(
true);
82 $this->form->addItem(
$file);
84 $this->form->addCommandButton(
"uploadFiles",
$lng->txt(
"upload"));
85 $this->form->addCommandButton(
"cancelAll",
$lng->txt(
"cancel"));
87 $this->form->setTableWidth(
"100%");
88 $this->form->setTitle(
$lng->txt(
"upload_files_title"));
92 $this->form->setTitle(
$lng->txt(
"upload_files"));
93 $this->form->setFormAction(
$ilCtrl->getFormAction($this,
"uploadFiles"));
94 $this->form->setTarget(
"cld_blank_target");
99 echo
"<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterUpload('cancel');</script>";
109 $response =
new stdClass();
110 $response->error =
null;
111 $response->debug =
null;
114 if ($this->form->checkInput())
118 $fileresult = $this->
handleFileUpload($this->form->getInput(
"upload_files"));
121 $response = (object)array_merge((array)$response, (array)$fileresult);
125 $response->error = $e->getMessage();
130 $response->error =
$error->getMessage();
134 header(
'Vary: Accept');
135 header(
'Content-type: text/plain');
143 $response =
new stdClass();
144 $response->fileName =
$_POST[
"title"];
145 $response->fileSize = intval($file_upload[
"size"]);
146 $response->fileType = $file_upload[
"type"];
147 $response->fileUnzipped = $file_upload[
"extract"];
148 $response->error =
null;
152 if ($file_upload[
"extract"])
157 include_once
'./Services/Utilities/classes/class.ilFileUtils.php';
164 $response->error = $e->getMessage();
175 $response->error = $e->getMessage();
185 $file_tree->uploadFileToService(
$_SESSION[
"cld_folder_id"], $file_upload[
"tmp_name"],
$_POST[
"title"]);
200 protected function uploadDirectory($dir, $parent_id, $file_tree, $keep_structure =
true) {
201 $dirlist = opendir($dir);
203 while (
false !== (
$file = readdir ($dirlist)))
206 if (!is_file($dir .
"/" .
$file) && !is_dir($dir .
"/" .
$file))
214 $newpath = $dir.
'/'.
$file;
215 if (is_dir($newpath))
219 $newnode = $file_tree->addFolderToService($parent_id, basename($newpath));
229 $file_tree->uploadFileToService($parent_id, $newpath, basename($newpath));
An exception for terminatinating execution or to throw for unit testing.
static getFileTreeFromSession()
Class ilCloudPluginUploadGUI.
uploadFiles()
Update properties.
handleFileUpload($file_upload)
executeCommand()
execute command
uploadDirectory($dir, $parent_id, $file_tree, $keep_structure=true)
Recursive Method to upload a directory.
Base class for ILIAS Exception handling.
static processZipFile($a_directory, $a_file, $structure, $ref_id=null, $containerType=null, $tree=null, $access_handler=null)
unzips in given directory and processes uploaded zip for use as single files
static encode($mixed, $suppress_native=false)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
if(!is_array($argv)) $options