public function filesUpload($files, $target, $fileType, $count, $maxSize = 7992000000)
    {
        $status = [];
        for ($i = 0; $i <= $count; $i++) {
            $exactName = basename($files['name'][$i]);
            $fileTmp = $files['tmp_name'][$i];
            $fileSize = $files['size'][$i];
            $error = $files['error'][$i];
            $type = $files['type'][$i];
            $ext = pathinfo($files['name'][$i], PATHINFO_EXTENSION);
            $newName = \Zest\Site\Site::salts(30);
            $fileNewName = $newName.'.'.$ext;
            $allowerd_ext = $this->types[$fileType];
            if (in_array($type, $this->mineTypes) === false) {
                $status[$i] = [
                    'status'  => 'error',
                    'code'    => 'mineType',
                    'message' => sprintf(printl('z:files:error:mine:type'), $type),
                ];
            }
            if (in_array($ext, $allowerd_ext) === true) {
                if ($error === 0) {
                    if ($fileSize <= $maxSize) {
                        $this->mkdir($target);
                        $fileRoot = $target.$fileNewName;
                        if (is_uploaded_file($fileTmp)) {
                            if (move_uploaded_file($fileTmp, $fileRoot)) {
                                $status[$i] = [
                                    'status'  => 'success',
                                    'code'    => $fileNewName,
                                    'message' => printl('z:files:success'),
                                    'name'    => $exactName,
                                ];
                            } else {
                                $status[$i] = [
                                    'status'  => 'error',
                                    'code'    => 'somethingwrong',
                                    'message' => printl('z:files:error:somethingwrong'),
                                ];
                            }
                        } else {
                            return [
                                'status'  => 'error',
                                'code'    => 'invilidfile',
                                'message' => printl('z:files:error:invilid:file'),
                            ];
                        }
                    } else {
                        $status[$i] = [
                            'status'  => 'error',
                            'code'    => 'exceedlimit',
                            'message' => sprintf(printl('z:files:error:exceed:limit'), $maxSize),
                        ];
                    }
                } else {
                    $status[$i] = [
                        'status'  => 'error',
                        'code'    => $error,
                        'message' => $error,
                    ];
                }
            } else {
                $status[$i] = [
                        'status'  => 'error',
                        'code'    => 'extension',
                        'message' => sprintf(printl('z:files:error:extension'), $ext),
                ];
            }
        }

        return $status;
    }
public function filesUpload($files, $target, $fileType, $count, $maxSize = 7992000000)
    {
        $status = [];
        for ($i = 0; $i <= $count; $i++) {
            $exactName = basename($files['name'][$i]);
            $fileTmp = $files['tmp_name'][$i];
            $fileSize = $files['size'][$i];
            $error = $files['error'][$i];
            $type = $files['type'][$i];
            $ext = pathinfo($files['name'][$i], PATHINFO_EXTENSION);
            $newName = \Zest\Site\Site::salts(30);
            $fileNewName = $newName.'.'.$ext;
            $allowerd_ext = $this->types[$fileType];
            if (in_array($type, $this->mineTypes) === false) {
                $status[$i] = [
                    'status'  => 'error',
                    'code'    => 'mineType',
                    'message' => sprintf(printl('z:files:error:mine:type'), $type),
                ];
            }
            if (in_array($ext, $allowerd_ext) === true) {
                if ($error === 0) {
                    if ($fileSize <= $maxSize) {
                        $this->mkdir($target);
                        $fileRoot = $target.$fileNewName;
                        if (is_uploaded_file($fileTmp)) {
                            if (move_uploaded_file($fileTmp, $fileRoot)) {
                                $status[$i] = [
                                    'status'  => 'success',
                                    'code'    => $fileNewName,
                                    'message' => printl('z:files:success'),
                                    'name'    => $exactName,
                                ];
                            } else {
                                $status[$i] = [
                                    'status'  => 'error',
                                    'code'    => 'somethingwrong',
                                    'message' => printl('z:files:error:somethingwrong'),
                                ];
                            }
                        } else {
                            return [
                                'status'  => 'error',
                                'code'    => 'invilidfile',
                                'message' => printl('z:files:error:invilid:file'),
                            ];
                        }
                    } else {
                        $status[$i] = [
                            'status'  => 'error',
                            'code'    => 'exceedlimit',
                            'message' => sprintf(printl('z:files:error:exceed:limit'), $maxSize),
                        ];
                    }
                } else {
                    $status[$i] = [
                        'status'  => 'error',
                        'code'    => $error,
                        'message' => $error,
                    ];
                }
            } else {
                $status[$i] = [
                        'status'  => 'error',
                        'code'    => 'extension',
                        'message' => sprintf(printl('z:files:error:extension'), $ext),
                ];
            }
        }

        return $status;
    }
public function filesUpload ( $ files , $ target , $ fileType , $ count , $ maxSize = 7992000000 ) { $ status = [ ] ; for ( $ i = 0 ; $ i <= $ count ; $ i ++ ) { $ exactName = basename ( $ files [ 'name' ] [ $ i ] ) ; $ fileTmp = $ files [ 'tmp_name' ] [ $ i ] ; $ fileSize = $ files [ 'size' ] [ $ i ] ; $ error = $ files [ 'error' ] [ $ i ] ; $ type = $ files [ 'type' ] [ $ i ] ; $ ext = pathinfo ( $ files [ 'name' ] [ $ i ] , PATHINFO_EXTENSION ) ; $ newName = \ Zest \ Site \ Site :: salts ( 30 ) ; $ fileNewName = $ newName . '.' . $ ext ; $ allowerd_ext = $ this -> types [ $ fileType ] ; if ( in_array ( $ type , $ this -> mineTypes ) === false ) { $ status [ $ i ] = [ 'status' => 'error' , 'code' => 'mineType' , 'message' => sprintf ( printl ( 'z:files:error:mine:type' ) , $ type ) , ] ; } if ( in_array ( $ ext , $ allowerd_ext ) === true ) { if ( $ error === 0 ) { if ( $ fileSize <= $ maxSize ) { $ this -> mkdir ( $ target ) ; $ fileRoot = $ target . $ fileNewName ; if ( is_uploaded_file ( $ fileTmp ) ) { if ( move_uploaded_file ( $ fileTmp , $ fileRoot ) ) { $ status [ $ i ] = [ 'status' => 'success' , 'code' => $ fileNewName , 'message' => printl ( 'z:files:success' ) , 'name' => $ exactName , ] ; } else { $ status [ $ i ] = [ 'status' => 'error' , 'code' => 'somethingwrong' , 'message' => printl ( 'z:files:error:somethingwrong' ) , ] ; } } else { return [ 'status' => 'error' , 'code' => 'invilidfile' , 'message' => printl ( 'z:files:error:invilid:file' ) , ] ; } } else { $ status [ $ i ] = [ 'status' => 'error' , 'code' => 'exceedlimit' , 'message' => sprintf ( printl ( 'z:files:error:exceed:limit' ) , $ maxSize ) , ] ; } } else { $ status [ $ i ] = [ 'status' => 'error' , 'code' => $ error , 'message' => $ error , ] ; } } else { $ status [ $ i ] = [ 'status' => 'error' , 'code' => 'extension' , 'message' => sprintf ( printl ( 'z:files:error:extension' ) , $ ext ) , ] ; } } return $ status ; }
Upload files.

@param (array)  $files    Files to be uploaded.
@param (string) $target   Target where file should be upload.
@param (string) $fileType Supported => image,media,docs,zip.
@param (int)    $count    Number of file count.
@param (int)    $maxSize  File size to be allowed.

@since 3.0.0

@return void
Upload files .