Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
file.php
1<?php
3
14
15class File
16{
18 protected $package;
20 protected $data = array();
24 protected static $http = null;
25
31 public function __construct($package, array $file)
32 {
33 $hash = self::initHash(array("id" => $file["id"], "name" => $file["name"]));
34 $this->data = array(
35 "hash" => $hash,
36 "id" => $file["id"],
37 "uploadStatus" => null,
38 "executeStatus" => null,
39 "name" => $file["name"],
40 "type" => $file["type"],
41 "size" => $file["size"],
42 "files" => array(
43 "default" => array()
44 )
45 ) + $file;
46
47 $this->package = $package;
48
49 if (FileInputUtility::instance()->checkFile($this->package->getCid(), $hash))
50 {
51 $this->data = self::getFromCache($hash, $this->package->getPath());
52 $eventName = "onFileIsContinued";
53 }
54 else
55 {
56 $eventName = "onFileIsStarted";
57 }
58 FileInputUtility::instance()->registerFile($this->package->getCid(), $this->getHash());
59 $this->errorCollection = new ErrorCollection();
60
61 foreach(GetModuleEvents(Uploader::EVENT_NAME, $eventName, true) as $event)
62 {
63 $error = "";
64 if (!ExecuteModuleEventEx($event, array($this->getHash(), &$this->data, &$error)))
65 {
66 $this->addError(new Error($error, "BXU350.1"));
67 break;
68 }
69 }
70 }
75 public static function initHash($file = array())
76 {
77 if (empty($file["id"]))
78 return md5($file["name"]);
79 if (preg_match("/^file([0-9]+)$/", $file["id"]))
80 return $file["id"];
81 return md5($file["id"]);
82 }
83
87 public function getId()
88 {
89 return $this->data["id"];
90 }
91
95 public function getHash()
96 {
97 return $this->data["hash"];
98 }
102 public function getName()
103 {
104 return $this->data["name"];
105 }
109 public function getSize()
110 {
111 return $this->data["size"];
112 }
116 public function getType()
117 {
118 return $this->data["type"];
119 }
125 public function getFile($code)
126 {
127 return $this->data["files"][$code];
128 }
135 public function setFile($code, $data)
136 {
137 $this->data["files"][$code] = $data;
138 $this->saveLog();
139 }
140
148 public function saveFile(&$file, Storable $storage, array $copies)
149 {
150 $result = new Result();
151 $code = $file["code"];
152
153 if ($code !== "default" && !array_key_exists($code, $copies))
154 {
155 $result->addError(new Error("The copy name is not in the list."));
156 }
157 else if ($this->isUploaded())
158 {
159 return $result;
160 }
161 else if (isset($file["chunkId"]))
162 {
163 $info = $this->getFile($code);
164 if (empty($info))
165 $info = array(
166 "name" => $this->getName(),
167 "code" => $code,
168 "type" => $file["type"],
169 "uploadStatus" => "inprogress",
170 "count" => $file["count"],
171 "chunks" => array());
172 $file["chunks"] = $info["chunks"];
173 $r = $storage->copy($this->package->getPath().$this->getHash(), $file);
174 if (!$r->isSuccess())
175 {
176 $result->addError($r->getErrorCollection()->current());
177 }
178 else
179 {
180 $info["chunks"][$file["chunkId"]] = array(
181 "size" => $file["size"],
182 "number" => $file["number"],
183 "start" => $file["start"],
184 "error" => $file["error"]
185 );
186 $file["uploadStatus"] = "uploaded";
187 $data = $r->getData();
188 if (count($info["chunks"]) == $info["count"])
189 {
190 $data["name"] = $this->getName();
191 $data["code"] = $info["code"];
192 $data["uploadStatus"] = "uploaded";
193 $info = $data + array_intersect_key($info, ["width" => "", "height" => ""]);
194 }
195 else
196 {
197 $info += array_intersect_key($data, ["width" => "", "height" => ""]);
198 }
199 $this->setFile($code, $info);
200 $storage->flushDescriptor();
201 }
202 }
203 else
204 {
205 $r = $storage->copy($this->package->getPath().$this->getHash(), $file);
206 if ($r->isSuccess())
207 {
208 $data = $r->getData();
209 $data["name"] = $this->getName();
210 $data["code"] = $code;
211 $data["uploadStatus"] = "uploaded";
212 $this->setFile($code, $data);
213 }
214 else
215 {
216 $result->addError($r->getErrorCollection()->current());
217 }
218 }
219 if ($result->isSuccess())
220 {
221 $info = $this->getFile($code);
222 if ($info["uploadStatus"] == "uploaded")
223 {
224 $info["url"] = $this->getUrl("view", $code);
225 $info["~url"] = $this->getUrl("view", $code, \COption::GetOptionString("main.fileinput", "entryPointUrl", "/bitrix/tools/upload.php"));
226 $info["sizeFormatted"] = \CFile::FormatSize($info["size"]);
227 foreach ($this->data["files"] as $k => $f)
228 {
229 if ($f["uploadStatus"] == "uploaded")
230 unset($copies[$k]);
231 }
232 if (empty($copies))
233 $this->setUploadStatus("uploaded");
234 }
235 $this->setFile($code, $info);
236 }
237 return $result;
238 }
239
244 public function saveLog()
245 {
246 static $lastSaved = null;
247 if ($lastSaved != $this->data)
248 {
249 $lastSaved = self::arrayWalkRecursive($this->data);
250 self::setIntoCache($this->data["hash"], $this->package->getPath(), $lastSaved);
251 }
252 }
253
259 protected static function arrayWalkRecursive(array $array)
260 {
261 foreach ($array as $k => $v)
262 {
263 if (is_array($v))
264 {
265 $array[$k] = self::arrayWalkRecursive($v);
266 }
267 else if (is_object($v))
268 {
269 unset($array[$k]);
270 }
271 }
272 return $array;
273 }
274
280 public function addError(Error $error)
281 {
282 $this->errorCollection->add(array($error));
283 }
284
289 public function hasError()
290 {
291 return !$this->errorCollection->isEmpty();
292 }
293
298 public function getErrorCollection()
299 {
300 return $this->errorCollection;
301 }
302
307 public function getErrorMessage()
308 {
309 $m = [];
310 for ($this->errorCollection->rewind(); $this->errorCollection->valid(); $this->errorCollection->next())
311 {
313 $error = $this->errorCollection->current();
314 $m[] = ($error->getMessage()?:$error->getCode());
315 }
316 return implode("", $m);
317 }
324 protected static function getFromCache($hash, $path)
325 {
326 return unserialize(\CBXVirtualIo::GetInstance()->GetFile($path.$hash."/.log")->GetContents(), ['allowed_classes' => false]);
327 }
328
334 public static function deleteCache(Package $package, array $file)
335 {
336 $hash = self::initHash($file);
337 if (FileInputUtility::instance()->checkFile($package->getCid(), $hash))
338 {
339 $file = \CBXVirtualIo::GetInstance()->GetFile($package->getPath().$hash."/.log");
340 if ($file->IsExists())
341 $file->unlink();
342 FileInputUtility::instance()->unRegisterFile($package->getCid(), $hash);
343 }
344 }
345
353 protected static function setIntoCache($hash, $path, $data)
354 {
355 $io = \CBXVirtualIo::GetInstance();
356 $directory = $io->GetDirectory($path.$hash);
357 if ($directory->Create())
358 $io->GetFile($path.$hash."/.log")->PutContents(serialize($data));
359 }
368 static function merge($res, $res2)
369 {
370 $res = is_array($res) ? $res : array();
371 $res2 = is_array($res2) ? $res2 : array();
372 foreach ($res2 as $key => $val)
373 {
374 if (array_key_exists($key, $res) && is_array($val))
375 $res[$key] = self::merge($res[$key], $val);
376 else
377 $res[$key] = $val;
378 }
379 return $res;
380 }
381
387 public function setUploadStatus($status)
388 {
389 $this->data["uploadStatus"] = $status;
390 $this->saveLog();
391 }
392
397 public function isUploaded()
398 {
399 return ($this->data["uploadStatus"] === "uploaded");
400 }
401
407 public function setExecuteStatus($status)
408 {
409 $this->data["executeStatus"] = $status;
410 $this->saveLog();
411 }
412
417 public function isExecuted()
418 {
419 return ($this->data["executeStatus"] === "executed");
420 }
421
426 public function toArray()
427 {
428 return $this->data;
429 }
430
436 public function fromArray(array $data)
437 {
438 $data["id"] = $this->data["id"];
439 $data["hash"] = $this->data["hash"];
440 $this->data = $data;
441 $this->saveLog();
442 }
443
450 public static function deleteFile($cid, $hash, $path)
451 {
452 if (FileInputUtility::instance()->unRegisterFile($cid, $hash))
453 {
454 $io = \CBXVirtualIo::GetInstance();
455 $directory = $io->GetDirectory($path.$hash);
456 $res = $directory->GetChildren();
457 foreach($res as $file)
458 $file->unlink();
459 $directory->rmdir();
460
461 return true;
462 }
463 return false;
464 }
471 public static function viewFile($cid, $hash, $path)
472 {
473 $file = false;
474 $copy = "";
475 if (mb_strpos($hash, "_") > 0)
476 {
477 $copy = explode("_", $hash);
478 $hash = $copy[0]; $copy = $copy[1];
479 }
480 $copy = ($copy ?:"default");
481 if (FileInputUtility::instance()->checkFile($cid, $hash))
482 {
483 $file = self::getFromCache($hash, $path);
484 $file = $file["files"][$copy];
485 }
486
487 if (is_array($file))
488 {
489 $docRoot = Application::getInstance()->getContext()->getServer()->getDocumentRoot();
490 if (mb_strpos(\CTempFile::GetAbsoluteRoot(), $docRoot) === 0)
491 \CFile::ViewByUser($file, array("content_type" => $file["type"]));
492 else
493 self::view($file, array("content_type" => $file["type"]));
494 }
495 }
501 private function getUrl($act = "view", $copy = "default", $url = null)
502 {
503 $url = is_null($url) ? Context::getCurrent()->getRequest()->getRequestUri() : $url;
504
505 $uri = (new Uri($url))
506 ->addParams([
507 Uploader::INFO_NAME => [
508 "CID" => $this->package->getCid(),
509 "mode" => $act,
510 "hash" => $this->getHash(),
511 "copy" => $copy
512 ],
513 ])
514 ->toAbsolute()
515 ;
516
517 return $uri->getUri();
518 }
519
520 public static function getUrlFromRelativePath($tmpName)
521 {
522 $io = \CBXVirtualIo::GetInstance();
523 if (($tempRoot = \CTempFile::GetAbsoluteRoot()) && ($filePath = $tempRoot.$tmpName) && $io->FileExists($filePath))
524 {
525 $f = $io->GetFile($filePath);
526 $directory = $io->GetDirectory($f->GetPath());
527 $hash = $directory->GetName();
528 if (($cache = self::getFromCache($hash, $directory->GetPath()."/")) && is_array($cache) &&
529 array_key_exists("files", $cache) && array_key_exists($f->getName(), $cache["files"]))
530 {
531 return $cache["files"][$f->getName()]["~url"];
532 }
533 }
534 return false;
535 }
536
541 public static function getUploadErrorMessage($error)
542 {
543 switch ($error)
544 {
545 case UPLOAD_ERR_INI_SIZE:
546 $message = Loc::getMessage("BXU_UPLOAD_ERR_INI_SIZE");
547 break;
548 case UPLOAD_ERR_FORM_SIZE:
549 $message = Loc::getMessage("BXU_UPLOAD_ERR_FORM_SIZE");
550 break;
551 case UPLOAD_ERR_PARTIAL:
552 $message = Loc::getMessage("BXU_UPLOAD_ERR_PARTIAL");
553 break;
554 case UPLOAD_ERR_NO_FILE:
555 $message = Loc::getMessage("BXU_UPLOAD_ERR_NO_FILE");
556 break;
557 case UPLOAD_ERR_NO_TMP_DIR:
558 $message = Loc::getMessage("BXU_UPLOAD_ERR_NO_TMP_DIR");
559 break;
560 case UPLOAD_ERR_CANT_WRITE:
561 $message = Loc::getMessage("BXU_UPLOAD_ERR_CANT_WRITE");
562 break;
563 case UPLOAD_ERR_EXTENSION:
564 $message = Loc::getMessage("BXU_UPLOAD_ERR_EXTENSION");
565 break;
566 default:
567 $message = 'Unknown uploading error ['.$error.']';
568 break;
569 }
570 return $message;
571 }
572
576 public static function http()
577 {
578 if (is_null(static::$http))
579 {
580 static::$http = new HttpClient;
581 static::$http->setPrivateIp(false);
582 }
583 return static::$http;
584 }
585
592 public static function checkFile(&$file, File $f, $params)
593 {
594 $result = new Result();
595 if ($file["error"] > 0)
596 $result->addError(new Error(File::getUploadErrorMessage($file["error"]), "BXU347.2.9".$file["error"]));
597 else if (array_key_exists("tmp_url", $file))
598 {
599 $url = new Uri($file["tmp_url"]);
600 if ($url->getHost() == '' && ($tmp = \CFile::MakeFileArray($url->getPath())) && is_array($tmp))
601 {
602 $file = array_merge($tmp, $file);
603 }
604 else if ($url->getHost() <> '' &&
605 self::http()->query("HEAD", $file["tmp_url"]) &&
606 self::http()->getStatus() == "200")
607 {
608 $file = array_merge($file, array(
609 "size" => self::http()->getHeaders()->get("content-length"),
610 "type" => self::http()->getHeaders()->get("content-type")
611 ));
612 }
613 else
614 {
615 $result->addError(new Error(Loc::getMessage("BXU_FileIsNotUploaded"), "BXU347.2"));
616 }
617 }
618 else if (isset($file['bucketId']) && !CloudStorage::checkBucket($file['bucketId']))
619 {
620 $result->addError(new Error(Loc::getMessage("BXU_FileIsNotUploaded"), "BXU347.2.8"));
621 }
622 else if (!isset($file['bucketId']) && (!file_exists($file['tmp_name']) || (
623 (mb_substr($file["tmp_name"], 0, mb_strlen($params["path"])) !== $params["path"]) &&
624 !is_uploaded_file($file['tmp_name'])
625 ))
626 )
627 {
628 $result->addError(new Error(Loc::getMessage("BXU_FileIsNotUploaded"), "BXU347.2.7"));
629 }
630
631 if ($result->isSuccess())
632 {
633 $params["uploadMaxFilesize"] = $params["uploadMaxFilesize"] ?? 0;
634 $params["allowUploadExt"] = $params["allowUploadExt"] ?? false;
635 $params["allowUpload"] = $params["allowUpload"] ?? null; // 'I' - image, 'F' - files with ext in $params["allowUploadExt"]
636
637 if ($params["uploadMaxFilesize"] > 0 && $f->getSize() > $params["uploadMaxFilesize"])
638 {
639 $error = GetMessage("FILE_BAD_SIZE")." (".\CFile::FormatSize($f->getSize()).").";
640 }
641 else
642 {
643 $name = $f->getName();
644 $ff = array_merge($file, array("name" => $name));
645 if ($params["allowUpload"] === "I")
646 {
647 $error = \CFile::CheckFile($ff, $params["uploadMaxFilesize"], "image/", \CFile::GetImageExtensions());
648 }
649 elseif ($params["allowUpload"] === "F" && $params["allowUploadExt"])
650 {
651 $error = \CFile::CheckFile($ff, $params["uploadMaxFilesize"], false, $params["allowUploadExt"]);
652 }
653 else
654 {
655 $error = \CFile::CheckFile($ff, $params["uploadMaxFilesize"]);
656 }
657 }
658
659 if ($error !== "")
660 $result->addError(new Error($error, "BXU347.3"));
661 }
662 if (preg_match("/^(.+?)\\.ch(\\d+)\\.(\\d+)\\.chs(\\d+)$/", $file["code"], $matches))
663 {
664 $file["code"] = $matches[1];
665 $file["number"] = $matches[2];
666 $file["start"] = $matches[3];
667 $file["count"] = $matches[4];
668 $file["chunkId"] = self::getChunkKey($file["count"], $file["number"]);
669 }
670 $file["~size"] = $f->getSize();
671 $file["~name"] = $f->getName();
672 $file["~type"] = $f->getType();
673
674 return $result;
675 }
682 protected static function getChunkKey($chunksCount, $chunkNumber)
683 {
684 $chunksCount = max(ceil(log10($chunksCount)), 4);
685 return "p".str_pad($chunkNumber, $chunksCount, "0", STR_PAD_LEFT);
686 }
687
695 public static function createCanvas($source, $dest, $canvasParams = array(), $watermarkParams = array())
696 {
697 $watermark = (array_key_exists("watermark", $source) ? array() : $watermarkParams);
698 if (\CFile::ResizeImageFile(
699 $source["tmp_name"],
700 $dest["tmp_name"],
701 $canvasParams,
702 BX_RESIZE_IMAGE_PROPORTIONAL,
703 $watermark,
704 $canvasParams["quality"],
705 array()
706 ))
707 {
708 $dest = array_merge($source, $dest);
709 if (array_key_exists("watermark", $source) || !empty($watermarkParams))
710 $dest["watermark"] = true;
711 }
712 else
713 $dest["error"] = 348;
714 $dest["size"] = filesize($dest["tmp_name"]);
715 $dest["type"] = $dest["type"] ?: \CFile::GetContentType($dest["tmp_name"]);
716 $dest["sizeFormatted"] = \CFile::FormatSize($dest["size"]);
717
718 return $dest;
719 }
720
726 public static function view(array $fileData, $options = array())
727 {
728 if (!array_key_exists("tmp_name", $fileData) || empty($fileData["tmp_name"]))
729 return false;
730
732 global $APPLICATION;
733
734 $fastDownload = (\COption::GetOptionString('main', 'bx_fast_download', 'N') == 'Y');
735
736 $attachment_name = "";
737 $content_type = (array_key_exists("type", $fileData) && !empty($fileData["type"]) ? $fileData["type"] : "");
738 $cache_time = 10800;
739 $fromClouds = false;
740 $filetime = 0;
741
742 if(is_array($options))
743 {
744 if(isset($options["content_type"]))
745 $content_type = $options["content_type"];
746 if(isset($options["specialchars"]))
747 $specialchars = $options["specialchars"];
748 if(isset($options["force_download"]))
749 $force_download = $options["force_download"];
750 if(isset($options["cache_time"]))
751 $cache_time = intval($options["cache_time"]);
752 if(isset($options["attachment_name"]))
753 $attachment_name = $options["attachment_name"];
754 }
755
756 if($cache_time < 0)
757 $cache_time = 0;
758
759 $name = str_replace(array("\n", "\r"), '', $fileData["name"]);
760
761 if ($attachment_name)
762 $attachment_name = str_replace(array("\n", "\r"), '', $attachment_name);
763 else
764 $attachment_name = $name;
765
766 $content_type = Web\MimeType::normalize($content_type);
767
768 $src = null;
769 $file = null;
770 if (mb_strpos($fileData["tmp_name"], \CTempFile::GetAbsoluteRoot()) === 0)
771 {
772 $file = new \Bitrix\Main\IO\File($fileData["tmp_name"]);
773 try
774 {
775 $src = $file->open(\Bitrix\Main\IO\FileStreamOpenMode::READ);
776 }
777 catch(\Bitrix\Main\IO\IoException $e)
778 {
779 return false;
780 }
781 $filetime = $file->getModificationTime();
782 }
783 else
784 {
785 $fromClouds = true;
786 }
787
788 $APPLICATION->RestartBuffer();
789
790 $cur_pos = 0;
791 $filesize = $fileData["size"];
792 $size = $filesize-1;
793 $server = Application::getInstance()->getContext()->getServer();
794 $p = $server->get("HTTP_RANGE") && mb_strpos($server->get("HTTP_RANGE"), "=");
795 if(intval($p)>0)
796 {
797 $bytes = mb_substr($server->get("HTTP_RANGE"), $p + 1);
798 $p = mb_strpos($bytes, "-");
799 if($p !== false)
800 {
801 $cur_pos = floatval(mb_substr($bytes, 0, $p));
802 $size = floatval(mb_substr($bytes, $p + 1));
803 if ($size <= 0)
804 {
805 $size = $filesize - 1;
806 }
807 if ($cur_pos > $size)
808 {
809 $cur_pos = 0;
810 $size = $filesize - 1;
811 }
812 }
813 }
814
815 if ($server->getRequestMethod() == "HEAD")
816 {
817 \CHTTP::SetStatus("200 OK");
818 header("Accept-Ranges: bytes");
819 header("Content-Type: ".$content_type);
820 header("Content-Length: ".($size-$cur_pos+1));
821
822 if($filetime > 0)
823 header("Last-Modified: ".date("r", $filetime));
824 }
825 else
826 {
827 $lastModified = '';
828 if($cache_time > 0)
829 {
830 //Handle ETag
831 $ETag = md5($fileData["tmp_name"].$filesize.$filetime);
832 if ($server->get("HTTP_IF_NONE_MATCH") === $ETag)
833 {
834 \CHTTP::SetStatus("304 Not Modified");
835 header("Cache-Control: private, max-age=".$cache_time.", pre-check=".$cache_time);
836 die();
837 }
838 header("ETag: ".$ETag);
839
840 //Handle Last Modified
841 if($filetime > 0)
842 {
843 $lastModified = gmdate('D, d M Y H:i:s', $filetime).' GMT';
844 if ($server->get("HTTP_IF_NONE_MATCH") === $lastModified)
845 {
846 \CHTTP::SetStatus("304 Not Modified");
847 header("Cache-Control: private, max-age=".$cache_time.", pre-check=".$cache_time);
848 die();
849 }
850 }
851 }
852
853 $utfName = Uri::urnEncode($attachment_name, "UTF-8");
854 $translitName = \CUtil::translit($attachment_name, LANGUAGE_ID, array(
855 "max_len" => 1024,
856 "safe_chars" => ".",
857 "replace_space" => '-',
858 "change_case" => false,
859 ));
860
861 //Disable zlib for old versions of php <= 5.3.0
862 //it has broken Content-Length handling
863 if(ini_get('zlib.output_compression'))
864 ini_set('zlib.output_compression', 'Off');
865
866 if($cur_pos > 0)
867 \CHTTP::SetStatus("206 Partial Content");
868 else
869 \CHTTP::SetStatus("200 OK");
870
871 header("Content-Type: ".$content_type);
872 header("Content-Disposition: attachment; filename=\"".$translitName."\"; filename*=utf-8''".$utfName);
873 header("Content-Transfer-Encoding: binary");
874 header("Content-Length: ".($size-$cur_pos+1));
875 if(is_resource($src))
876 {
877 header("Accept-Ranges: bytes");
878 header("Content-Range: bytes ".$cur_pos."-".$size."/".$filesize);
879 }
880
881 if($cache_time > 0)
882 {
883 header("Cache-Control: private, max-age=".$cache_time.", pre-check=".$cache_time);
884 if($filetime > 0)
885 header('Last-Modified: '.$lastModified);
886 }
887 else
888 {
889 header("Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0");
890 }
891
892 header("Expires: 0");
893 header("Pragma: public");
894
895 // Download from front-end
896 if($fastDownload && ($fromClouds || mb_strpos($fileData["tmp_name"], Application::getInstance()->getContext()->getServer()->getDocumentRoot()) === 0))
897 {
898 if($fromClouds)
899 {
900 $filename = preg_replace('~^(http[s]?)(\://)~i', '\\1.' , $fileData["tmp_name"]);
901 $cloudUploadPath = \COption::GetOptionString('main', 'bx_cloud_upload', '/upload/bx_cloud_upload/');
902 header('X-Accel-Redirect: '.$cloudUploadPath.$filename);
903 }
904 else
905 {
906 header('X-Accel-Redirect: '.\Bitrix\Main\Text\Encoding::convertEncoding($fileData["tmp_name"], SITE_CHARSET, "UTF-8"));
907 }
908 }
909 else if ($src)
910 {
911 session_write_close();
912 $file->seek($cur_pos);
913 while(!feof($src) && ($cur_pos <= $size))
914 {
915 $bufsize = 131072; //128K
916 if($cur_pos + $bufsize > $size)
917 $bufsize = $size - $cur_pos + 1;
918 $cur_pos += $bufsize;
919 echo fread($src, $bufsize);
920 }
921 $file->close();
922 }
923 else
924 {
925 $src = new \Bitrix\Main\Web\HttpClient();
926 $fp = fopen("php://output", "wb");
927 $src->setOutputStream($fp);
928 $src->get($fileData["tmp_name"]);
929 }
930 }
931 \CMain::FinalActions();
932 die();
933 }}
getName()
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
addError(Error $error)
Definition file.php:280
__construct($package, array $file)
Definition file.php:31
static viewFile($cid, $hash, $path)
Definition file.php:471
static initHash($file=array())
Definition file.php:75
static getUploadErrorMessage($error)
Definition file.php:541
static createCanvas($source, $dest, $canvasParams=array(), $watermarkParams=array())
Definition file.php:695
saveFile(&$file, Storable $storage, array $copies)
Definition file.php:148
static deleteCache(Package $package, array $file)
Definition file.php:334
setFile($code, $data)
Definition file.php:135
static checkFile(&$file, File $f, $params)
Definition file.php:592
static arrayWalkRecursive(array $array)
Definition file.php:259
static merge($res, $res2)
Definition file.php:368
static getChunkKey($chunksCount, $chunkNumber)
Definition file.php:682
static view(array $fileData, $options=array())
Definition file.php:726
static setIntoCache($hash, $path, $data)
Definition file.php:353
static getUrlFromRelativePath($tmpName)
Definition file.php:520
static getFromCache($hash, $path)
Definition file.php:324
static deleteFile($cid, $hash, $path)
Definition file.php:450