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"));
88 $this->form->setTitle($lng->txt(
"upload_files"));
89 $this->form->setFormAction($ilCtrl->getFormAction($this,
"uploadFiles"));
90 $this->form->setTarget(
"cld_blank_target");
95 echo
"<script language='javascript' type='text/javascript'>window.parent.il.CloudFileList.afterUpload('cancel');</script>";
105 $response =
new stdClass();
106 $response->error = null;
107 $response->debug = null;
110 if ($this->form->checkInput())
114 $fileresult = $this->
handleFileUpload($this->form->getInput(
"upload_files"));
117 $response = (object)array_merge((array)$response, (array)$fileresult);
121 $response->error = $e->getMessage();
126 $response->error = $error->getMessage();
130 header(
'Vary: Accept');
131 header(
'Content-type: text/plain');
139 $response =
new stdClass();
140 $response->fileName =
$_POST[
"title"];
141 $response->fileSize = intval($file_upload[
"size"]);
142 $response->fileType = $file_upload[
"type"];
143 $response->fileUnzipped = $file_upload[
"extract"];
144 $response->error = null;
148 if ($file_upload[
"extract"])
153 include_once
'./Services/Utilities/classes/class.ilFileUtils.php';
160 $response->error = $e->getMessage();
171 $response->error = $e->getMessage();
181 $file_tree->uploadFileToService(
$_SESSION[
"cld_folder_id"], $file_upload[
"tmp_name"],
$_POST[
"title"]);
196 protected function uploadDirectory($dir, $parent_id, $file_tree, $keep_structure =
true) {
197 $dirlist = opendir($dir);
199 while (
false !== (
$file = readdir ($dirlist)))
202 if (!is_file($dir .
"/" .
$file) && !is_dir($dir .
"/" . $file))
207 if ($file !=
'.' && $file !=
'..')
209 $newpath = $dir.
'/'.
$file;
210 if (is_dir($newpath))
214 $newnode = $file_tree->addFolderToService($parent_id, basename($newpath));
224 $file_tree->uploadFileToService($parent_id, $newpath, basename($newpath));