4 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
5 include_once(
"./Services/JSON/classes/class.ilJsonUtil.php");
30 $cmd = $ilCtrl->getCmd();
44 $ilTabs->activateTab(
"content");
46 echo $this->form->getHTML();
50 $options->dropZone =
"#ilFileUploadDropZone_1";
51 $options->fileInput =
"#ilFileUploadInput_1";
52 $options->submitButton =
"uploadFiles";
53 $options->cancelButton =
"cancelAll";
54 $options->dropArea =
"#ilFileUploadDropArea_1";
55 $options->fileList =
"#ilFileUploadList_1";
56 $options->fileSelectButton =
"#ilFileUploadFileSelect_1";
57 echo
"<script language='javascript' type='text/javascript'>var fileUpload1 = new ilFileUpload(1, " .
ilJsonUtil::encode(
$options) .
");</script>";
68 include_once(
"./Services/Form/classes/class.ilDragDropFileInputGUI.php");
69 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
72 $this->form->setId(
"upload");
73 $this->form->setMultipart(
true);
74 $this->form->setHideLabels();
77 $file->setRequired(
true);
78 $this->form->addItem(
$file);
80 $this->form->addCommandButton(
"uploadFiles", $lng->txt(
"upload"));
81 $this->form->addCommandButton(
"cancelAll", $lng->txt(
"cancel"));
83 $this->form->setTableWidth(
"100%");
84 $this->form->setTitle($lng->txt(
"upload_files_title"));
87 $this->form->setTitle($lng->txt(
"upload_files"));
88 $this->form->setFormAction($ilCtrl->getFormAction($this,
"uploadFiles"));
89 $this->form->setTarget(
"cld_blank_target");
94 echo
"<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterUpload('cancel');</script>";
104 $response =
new stdClass();
105 $response->error = null;
106 $response->debug = null;
109 if ($this->form->checkInput())
113 $fileresult = $this->
handleFileUpload($this->form->getInput(
"upload_files"));
116 $response = (object)array_merge((array)$response, (array)$fileresult);
120 $response->error = $e->getMessage();
125 $response->error = $error->getMessage();
129 header(
'Vary: Accept');
130 header(
'Content-type: text/plain');
138 $response =
new stdClass();
139 $response->fileName =
$_POST[
"title"];
140 $response->fileSize = intval($file_upload[
"size"]);
141 $response->fileType = $file_upload[
"type"];
142 $response->fileUnzipped = $file_upload[
"extract"];
143 $response->error = null;
147 if ($file_upload[
"extract"])
152 include_once
'./Services/Utilities/classes/class.ilFileUtils.php';
159 $response->error = $e->getMessage();
170 $response->error = $e->getMessage();
180 $file_tree->uploadFileToService(
$_SESSION[
"cld_folder_id"], $file_upload[
"tmp_name"],
$_POST[
"title"]);
195 protected function uploadDirectory($dir, $parent_id, $file_tree, $keep_structure =
true) {
196 $dirlist = opendir($dir);
198 while (
false !== (
$file = readdir ($dirlist)))
201 if (!is_file($dir .
"/" .
$file) && !is_dir($dir .
"/" . $file))
206 if ($file !=
'.' && $file !=
'..')
208 $newpath = $dir.
'/'.
$file;
209 if (is_dir($newpath))
213 $newnode = $file_tree->addFolderToService($parent_id, basename($newpath));
223 $file_tree->uploadFileToService($parent_id, $newpath, basename($newpath));