|
| __construct ($options=array()) |
|
| setValidators (array $validators, $files=null) |
|
| removeValidator ($name) |
|
| clearValidators () |
|
| send ($options=null) |
|
| isValid ($files=null) |
|
| receive ($files=null) |
|
| isSent ($files=null) |
|
| isReceived ($files=null) |
|
| isFiltered ($files=null) |
|
| isUploaded ($files=null) |
|
| send ($options=null) |
|
| receive ($options=null) |
|
| isSent ($files=null) |
|
| isReceived ($files=null) |
|
| isUploaded ($files=null) |
|
| isFiltered ($files=null) |
|
| setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type) |
|
| getPluginLoader ($type) |
|
| addPrefixPath ($prefix, $path, $type=null) |
|
| addPrefixPaths (array $spec) |
|
| addValidator ($validator, $breakChainOnFailure=false, $options=null, $files=null) |
|
| addValidators (array $validators, $files=null) |
|
| setValidators (array $validators, $files=null) |
|
| hasValidator ($name) |
|
| getValidator ($name) |
|
| getValidators ($files=null) |
|
| removeValidator ($name) |
|
| clearValidators () |
|
| setOptions ($options=array(), $files=null) |
|
| getOptions ($files=null) |
|
| isValid ($files=null) |
|
| getMessages () |
|
| getErrors () |
|
| hasErrors () |
|
| addFilter ($filter, $options=null, $files=null) |
|
| addFilters (array $filters, $files=null) |
|
| setFilters (array $filters, $files=null) |
|
| hasFilter ($name) |
|
| getFilter ($name) |
|
| getFilters ($files=null) |
|
| removeFilter ($name) |
|
| clearFilters () |
|
| getFile () |
|
| getFileName ($file=null, $path=true) |
|
| getFileInfo ($file=null) |
|
| addFile ($file, $validator=null, $filter=null) |
|
| getType () |
|
| addType ($type, $validator=null, $filter=null) |
|
| setDestination ($destination, $files=null) |
|
| getDestination ($files=null) |
|
| setTranslator ($translator=null) |
|
| getTranslator () |
|
| setDisableTranslator ($flag) |
|
| translatorIsDisabled () |
|
| getHash ($hash='crc32', $files=null) |
|
| getFileSize ($files=null) |
|
| getMimeType ($files=null) |
|
Definition at line 35 of file Http.php.
◆ __construct()
__construct |
( |
|
$options = array() | ) |
|
Constructor for Http File Transfers
- Parameters
-
array | $options | OPTIONAL Options to set |
Definition at line 45 of file Http.php.
47 if (
ini_get(
'file_uploads') ==
false) {
48 #require_once 'Zend/File/Transfer/Exception.php';
addValidator($validator, $breakChainOnFailure=false, $options=null, $files=null)
setOptions($options=array(), $files=null)
◆ _prepareFiles()
Prepare the $_FILES array to match the internal syntax of one file per entry
- Parameters
-
- Returns
- array
Definition at line 435 of file Http.php.
437 $this->_files = array();
438 foreach ($_FILES as $form =>
$content) {
440 foreach (
$content as $param => $file) {
443 $this->_files[$form][
'multifiles'][
$number] = $form .
'_' .
$number .
'_';
447 $this->_files[$form][
'name'] = $form;
448 foreach($this->_files[$form][
'multifiles'] as $key =>
$value) {
450 $this->_files[
$value][
'validated'] =
false;
451 $this->_files[
$value][
'received'] =
false;
452 $this->_files[
$value][
'filtered'] =
false;
455 $this->_files[
$value][
'type'] = $mimetype;
458 $this->_files[
$value][
'size'] = $filesize;
460 if ($this->_options[
'detectInfos']) {
461 $_FILES[$form][
'type'][$key] = $mimetype;
462 $_FILES[$form][
'size'][$key] = $filesize;
468 $this->_files[$form][
'validated'] =
false;
469 $this->_files[$form][
'received'] =
false;
470 $this->_files[$form][
'filtered'] =
false;
473 $this->_files[$form][
'type'] = $mimetype;
476 $this->_files[$form][
'size'] = $filesize;
478 if ($this->_options[
'detectInfos']) {
479 $_FILES[$form][
'type'] = $mimetype;
480 $_FILES[$form][
'size'] = $filesize;
◆ clearValidators()
Remove an individual validator
- Parameters
-
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 91 of file Http.php.
93 parent::clearValidators();
addValidator($validator, $breakChainOnFailure=false, $options=null, $files=null)
◆ getProgress()
static getProgress |
( |
|
$id = null | ) |
|
|
static |
Returns the actual progress of file up-/downloads
- Parameters
-
string | $id | The upload to get the progress for |
- Returns
- array|null
Definition at line 307 of file Http.php.
310 #require_once 'Zend/File/Transfer/Exception.php'; 314 $session =
'Zend_File_Transfer_Adapter_Http_ProgressBar';
324 if (isset(
$id[
'progress'])) {
328 if (isset(
$id[
'session'])) {
332 if (isset(
$id[
'id'])) {
345 if (!isset($_GET[
'progress_key'])) {
346 $status[
'message'] =
'No upload in progress';
349 $id = $_GET[
'progress_key'];
354 if (self::isApcAvailable()) {
357 if (is_array($call)) {
360 }
else if (self::isUploadProgressAvailable()) {
362 if (is_array($call)) {
373 if (!is_array($call)) {
375 $status[
'message'] =
'Failure while retrieving the upload progress';
376 }
else if (!empty(
$status[
'cancel_upload'])) {
378 $status[
'message'] =
'The upload has been canceled';
388 #require_once 'Zend/ProgressBar.php'; 393 #require_once 'Zend/File/Transfer/Exception.php';
call_user_func($callable, $param)
static _toByteString($size)
◆ isApcAvailable()
static isApcAvailable |
( |
| ) |
|
|
static |
Checks the APC extension for progress information
- Returns
- boolean
Definition at line 414 of file Http.php.
416 return (
bool)
ini_get(
'apc.enabled') && (bool)
ini_get(
'apc.rfc1867') && is_callable(self::$_callbackApc);
◆ isFiltered()
isFiltered |
( |
|
$files = null | ) |
|
Checks if the file was already filtered
- Parameters
-
string | array | $files | (Optional) Files to check |
- Returns
- bool
Definition at line 263 of file Http.php.
271 if (
$content[
'filtered'] !==
true) {
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ isReceived()
isReceived |
( |
|
$files = null | ) |
|
Checks if the file was already received
- Parameters
-
string | array | $files | (Optional) Files to check |
- Returns
- bool
Definition at line 241 of file Http.php.
249 if (
$content[
'received'] !==
true) {
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ isSent()
Checks if the file was already sent
- Parameters
-
string | array | $file | Files to check |
- Returns
- bool
- Exceptions
-
Definition at line 229 of file Http.php.
231 #require_once 'Zend/File/Transfer/Exception.php';
◆ isUploaded()
isUploaded |
( |
|
$files = null | ) |
|
Has a file been uploaded ?
- Parameters
-
array | string | null | $file | |
- Returns
- bool
Definition at line 285 of file Http.php.
292 foreach (
$files as $file) {
293 if (empty($file[
'name'])) {
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ isUploadProgressAvailable()
static isUploadProgressAvailable |
( |
| ) |
|
|
static |
Checks the UploadProgress extension for progress information
- Returns
- boolean
Definition at line 424 of file Http.php.
426 return is_callable(self::$_callbackUploadProgress);
◆ isValid()
Checks if the files are valid
- Parameters
-
string | array | $files | (Optional) Files to check |
- Returns
- boolean True if all checks are valid
Definition at line 118 of file Http.php.
122 if (isset($_SERVER[
'CONTENT_LENGTH'])) {
123 $content = $_SERVER[
'CONTENT_LENGTH'];
124 }
else if (!empty($_POST)) {
129 if (empty($this->_files) && (
$content > 0)) {
131 if (0 === count(
$files)) {
138 $temp = array(
$files => array(
141 $validator = $this->_validators[
'Zend_Validate_File_Upload'];
142 $validator->setFiles($temp)
144 $this->_messages += $validator->getMessages();
148 return parent::isValid(
$files);
foreach($appDirs as $dir) $files
◆ receive()
Receive the file from the client (Upload)
- Parameters
-
string | array | $files | (Optional) Files to receive |
- Returns
- bool
Definition at line 157 of file Http.php.
164 foreach ($check as $file =>
$content) {
168 if ($destination !==
null) {
169 $directory = $destination . DIRECTORY_SEPARATOR;
172 $filename = $directory .
$content[
'name'];
174 if ($rename !==
null) {
175 $tmp = $rename->getNewName(
$content[
'tmp_name']);
180 if (dirname($filename) ==
'.') {
181 $filename = $directory . $filename;
184 $key = array_search(get_class($rename), $this->_files[$file][
'filters']);
185 unset($this->_files[$file][
'filters'][$key]);
189 if (!move_uploaded_file(
$content[
'tmp_name'], $filename)) {
190 if (
$content[
'options'][
'ignoreNoFile']) {
191 $this->_files[$file][
'received'] =
true;
192 $this->_files[$file][
'filtered'] =
true;
196 $this->_files[$file][
'received'] =
false;
200 if ($rename !==
null) {
201 $this->_files[$file][
'destination'] = dirname($filename);
202 $this->_files[$file][
'name'] = basename($filename);
205 $this->_files[$file][
'tmp_name'] = $filename;
206 $this->_files[$file][
'received'] =
true;
211 $this->_files[$file][
'filtered'] =
false;
215 $this->_files[$file][
'filtered'] =
true;
getDestination($files=null)
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ removeValidator()
◆ send()
Send the file to the client (Download)
- Parameters
-
string | array | $options | Options for the file(s) to send |
- Returns
- void
- Exceptions
-
Definition at line 106 of file Http.php.
108 #require_once 'Zend/File/Transfer/Exception.php';
◆ setValidators()
setValidators |
( |
array |
$validators, |
|
|
|
$files = null |
|
) |
| |
Sets a validator for the class, erasing all previous set
- Parameters
-
string | array | $validator | Validator to set |
string | array | $files | Files to limit this validator to |
- Returns
- Zend_File_Transfer_Adapter
Definition at line 64 of file Http.php.
addValidators(array $validators, $files=null)
foreach($appDirs as $dir) $files
◆ $_callbackApc
$_callbackApc = 'apc_fetch' |
|
staticprotected |
◆ $_callbackUploadProgress
$_callbackUploadProgress = 'uploadprogress_get_info' |
|
staticprotected |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/File/Transfer/Adapter/Http.php