Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function jpgUpload($data, $order, $path) {
- $imageAdapterJPG = new Zend_File_Transfer_Adapter_Http();
- try {
- if (file_exists($path)) {
- $diretorio = dir($path);
- while ($arquivo = $diretorio->read()) {
- unlink($path . '/' . $arquivo);
- }
- $diretorio->close();
- $imageAdapterJPG->setDestination($path);
- if (is_uploaded_file($data['tmp_name'])) {
- if (!$imageAdapterJPG->receive()) {
- die('Erro - Arquivo Não Recebido');
- }
- } else {
- die('Not Upload');
- }
- } else {
- if (mkdir($path, 0777)) {
- $imageAdapterJPG->setDestination($path);
- if (is_uploaded_file($data['tmp_name'])) {
- if (!$imageAdapterJPG->receive()) {
- die('Erro - Arquivo Não Recebido');
- }
- } else {
- die('Not Upload');
- }
- }
- }
- } catch (Exception $e) {
- var_dump($e);
- exit;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment