https://github.com/vinpac/upload-component
Classe de upload de arquivos.
https://github.com/vinpac/upload-component
Last synced: 3 months ago
JSON representation
Classe de upload de arquivos.
- Host: GitHub
- URL: https://github.com/vinpac/upload-component
- Owner: vinpac
- Created: 2015-01-31T19:06:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-03T14:12:40.000Z (over 11 years ago)
- Last Synced: 2026-01-14T20:31:06.462Z (7 months ago)
- Language: PHP
- Size: 2.14 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## UploadComponent
UploadComponent is a simple component developed to support uploading any kind of file through CakePHP. It gives you total control of uploaded files and special functions to deal with image upload
--
##### Usage example :
if($this->request->is('post')){
$able = $this->Upload->able($this->request->data['foto'], true);
if($able === true){
$foto = uniqid(time());
$img1 = $this->Upload->uploadIMG($this->request->data['foto'],
array(
"quality" => "H",
"resize"=>array(
"width" => 140,
"height" => 140,
"cover" => 'cover'
),
"name" => $foto."_140"
));
if($img1 !== true) $this->Session->setFlush('Algo de errado aconteceu : '.$img1 );
}else{
$this->Session->setFlush('Erro : '.$able);
}
}
--
##### Documentação :
--
###### *UploadComponent*::dir
Direitorio a ser salvo
--
###### *UploadComponent*::chagedir(*String* $dir)
Muda o direito atual a ser salvo
--
###### *UploadComponent*::trueFile(*File* $file)
Retorna o verdadeiro Array do arquivo
--
###### *UploadComponent*::file(*File* $file)
Seta o arquivo atual
--
###### *UploadComponent*::clear()
Limpa as variaveis e remove o arquivo sendo usado
--
###### *UploadComponent*::delete(*String* $name = *UploadComponent*::file, *String* $dir)
- **$name** Nome do arquivo
- **$dir** Direito do arquivo
Deleta um arquivo no diretorio atual
--
###### *UploadComponent*::fileType(*File* $file)
Retorna o tipo do arquivo
--
###### *UploadComponent*::uploadImg(*File* $file, *Array* $params)
- *Array** *$params**
* *Array* Resize
* *Integer* width
* *Integer* height
* *String* cover
* *String* Name
* *String* Quality
--
###### *UploadComponent*::able( *File* $file, *Boolean* $msg = false, *Array* $ext)
- **$file** Arquivo a ser verificado
- **$msg** Retornar uma messagem ou Boolean
- **$ext** Array com tipos de aquivo aceitos
--
###### *UploadComponent*::resize(*Integer* $w, *Integer* $h, *Integer* $x, *Integer* $y, *Boolean* $cover=false)
- **$w** Largura da imagem
- **$h** Altura da image
- **$x** Nova Largura
- **$y** Nova Altura
- **$cover** Cortar a imagem
Retorna um array com novo W, H, X, Y