Esempio n. 1
0
function upload($image)
{
    include "upload.inc.php";
    // Defining Class
    $yukle = new upload();
    // Set Max Size
    $yukle->set_max_size(180000);
    // Set Directory
    $yukle->set_directory("/home/jimgreen/public_html/images/" . $image . "");
    // Do not change
    // Set Temp Name for upload, $_FILES['file']['tmp_name'] is automaticly get the temp name
    $yukle->set_tmp_name($_FILES['file']['tmp_name']);
    // Do not change
    // Set file size, $_FILES['file']['size'] is automaticly get the size
    $yukle->set_file_size($_FILES['file']['size']);
    // Do not change
    // Set File Type, $_FILES['file']['type'] is automaticly get the type
    $yukle->set_file_type($_FILES['file']['type']);
    // Set File Name, $_FILES['file']['name'] is automaticly get the file name.. you can change
    $yukle->set_file_name($_FILES['file']['name']);
    // Start Copy Process
    $yukle->start_copy();
    // If uploaded file is image, you can resize the image width and height
    // Support gif, jpg, png
    $yukle->resize(218, 218);
    // Control File is uploaded or not
    // If there is error write the error message
    if ($yukle->is_ok()) {
        echo "ok";
    } else {
        echo $yukle->error() . "<br>";
    }
    // Set a thumbnail name
    $yukle->set_thumbnail_name("thumb1");
    // create thumbnail
    $yukle->create_thumbnail();
    // change thumbnail size
    $yukle->set_thumbnail_size(0, 250);
    $yukle->set_thumbnail_name("thumb2");
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(50, 0);
    $yukle->set_thumbnail_name("thumb3");
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(62, 150);
}
Esempio n. 2
0
$strEmpresa = $_POST['strEmpresa'];
$strCargo = $_POST['strCargo'];
$strPassword = $_POST['strPassword'];
$dblCredito = $_POST['dblCredito'];
$dblCredito = $_POST['dblCredito'];
$direccion = $_POST['direccion'];
$telefono = $_POST['telefono'];
$logo = $_POST['logo'];
list($dia, $mes, $anio) = explode('-', $_POST['vigencia_credito']);
$vigencia_credito = $anio . '-' . $mes . '-' . $dia;
$vendedor = $_POST['vendedor'];
if ($_FILES['logo']['name'] != "") {
    include_once '../resources/class.upload.php';
    $yukle = new upload();
    $yukle->set_max_size(99999999);
    $yukle->set_directory('../../images-clientes');
    $yukle->set_tmp_name($_FILES['logo']['tmp_name']);
    $yukle->set_file_size($_FILES['logo']['size']);
    $yukle->set_file_type($_FILES['logo']['type']);
    //random
    $random = substr(md5(rand()), 0, 6);
    $avatarname = $random . '_' . $_FILES['logo']['name'];
    $nombre_final = str_replace(' ', '-', $avatarname);
    $yukle->set_file_name($nombre_final);
    $yukle->start_copy();
    $yukle->resize(620, 0);
    $yukle->set_thumbnail_name('tn_' . $nombre_final);
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(300, 0);
    if ($yukle->is_ok()) {
        $logo = $nombre_final;
Esempio n. 3
0
 public function upload_file()
 {
     //1 = OK - 0 = Failure
     $file = array('status' => '', 'filename' => '', 'msg' => '');
     //check ext.
     $file_extensions_allowed = array('image/gif', 'image/png', 'image/jpeg', 'image/jpg');
     $exts_humano = array('gif', 'png', 'jpeg', 'jpg');
     $exts_humano = implode(', ', $exts_humano);
     $ext = $_FILES['filename']['type'];
     #$ext = strtolower($ext);
     if (!in_array($ext, $file_extensions_allowed)) {
         $exts = implode(', ', $file_extensions_allowed);
         $file['msg'] .= "<p>" . $_FILES['filename']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
     } else {
         include APPPATH . 'libraries/class.upload.php';
         $yukle = new upload();
         $yukle->set_max_size(1900000);
         $yukle->set_directory('./images-productos');
         $yukle->set_tmp_name($_FILES['filename']['tmp_name']);
         $yukle->set_file_size($_FILES['filename']['size']);
         $yukle->set_file_type($_FILES['filename']['type']);
         $random = substr(md5(rand()), 0, 6);
         $name_whitout_whitespaces = str_replace(" ", "-", $_FILES['filename']['name']);
         $imagname = '' . $random . '_' . $name_whitout_whitespaces;
         #$thumbname='tn_'.$imagname;
         $yukle->set_file_name($imagname);
         $yukle->start_copy();
         if ($yukle->is_ok()) {
             if (count($this->data['thumbnail_sizes'])) {
                 foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
                     //create thumbnail
                     $yukle->resize(1000, 0);
                     $yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
                     $result_thumb = $yukle->create_thumbnail();
                     $yukle->set_thumbnail_size($thumb_size, 0);
                 }
             }
             //UPLOAD ok
             $file['filename'] = $imagname;
             $file['status'] = 1;
         } else {
             $file['status'] = 0;
             $file['msg'] = 'Error al subir archivo';
         }
         //clean
         $yukle->set_tmp_name('');
         $yukle->set_file_size('');
         $yukle->set_file_type('');
         $imagname = '';
     }
     //fin if(extencion)
     return $file;
 }
Esempio n. 4
0
    $yukle->set_thumbnail_name('tn_' . $nombre_final);
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(300, 0);
    if ($yukle->is_ok()) {
        $strImagen2 = $nombre_final;
    } else {
        //si hay error cargo sin imagen
        $strImagen2 = "";
    }
}
/**/
if ($_FILES['strImagen3']['name'] != "") {
    include_once '../resources/class.upload.php';
    $yukle = new upload();
    $yukle->set_max_size(99999999);
    $yukle->set_directory('../../images_productos');
    $yukle->set_tmp_name($_FILES['strImagen3']['tmp_name']);
    $yukle->set_file_size($_FILES['strImagen3']['size']);
    $yukle->set_file_type($_FILES['strImagen3']['type']);
    //random
    $random = substr(md5(rand()), 0, 6);
    $avatarname = $random . '_' . $_FILES['strImagen3']['name'];
    $nombre_final = str_replace(' ', '-', $avatarname);
    $yukle->set_file_name($nombre_final);
    $yukle->start_copy();
    $yukle->resize(620, 0);
    $yukle->set_thumbnail_name('tn_' . $nombre_final);
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(300, 0);
    if ($yukle->is_ok()) {
        $strImagen3 = $nombre_final;
Esempio n. 5
0
 public function upload_file()
 {
     //1 = OK - 0 = Failure
     $file = array('status' => '', 'filename' => '', 'msg' => '');
     array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
     //check extencion
     /*
     $file_extensions_allowed = array('application/pdf', 'application/msword', 'application/rtf', 'application/vnd.ms-excel','application/vnd.ms-powerpoint','application/zip','application/x-rar-compressed', 'text/plain');
     $exts_humano = array('PDF', 'WORD', 'RTF', 'EXCEL', 'PowerPoint', 'ZIP', 'RAR');
     */
     $file_extensions_allowed = array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
     $exts_humano = array('JPG', 'JPEG', 'PNG', 'GIF');
     $exts_humano = implode(', ', $exts_humano);
     $ext = $_FILES['adjunto']['type'];
     #$ext = strtolower($ext);
     if (!in_array($ext, $file_extensions_allowed)) {
         $exts = implode(', ', $file_extensions_allowed);
         $file['msg'] .= "<p>" . $_FILES['adjunto']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
         $file['status'] = 0;
     } else {
         include APPPATH . 'libraries/class.upload.php';
         $yukle = new upload();
         $yukle->set_max_size(1900000);
         $yukle->set_directory('./images-lugares');
         $yukle->set_tmp_name($_FILES['adjunto']['tmp_name']);
         $yukle->set_file_size($_FILES['adjunto']['size']);
         $yukle->set_file_type($_FILES['adjunto']['type']);
         $random = substr(md5(rand()), 0, 6);
         $name_whitout_whitespaces = str_replace(" ", "-", $_FILES['adjunto']['name']);
         $imagname = '' . $random . '_' . $name_whitout_whitespaces;
         #$thumbname='tn_'.$imagname;
         $yukle->set_file_name($imagname);
         $yukle->start_copy();
         if ($yukle->is_ok()) {
             if (count($this->data['thumbnail_sizes'])) {
                 foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
                     //create thumbnail
                     $yukle->resize(1000, 0);
                     $yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
                     $result_thumb = $yukle->create_thumbnail();
                     $yukle->set_thumbnail_size($thumb_size, 0);
                 }
             }
             //UPLOAD ok
             $file['filename'] = $imagname;
             $file['status'] = 1;
         } else {
             $file['status'] = 0;
             $file['msg'] = 'Error al subir archivo';
         }
         //clean
         $yukle->set_tmp_name('');
         $yukle->set_file_size('');
         $yukle->set_file_type('');
         $imagname = '';
     }
     //fin if(extencion)
     return $file;
 }
Esempio n. 6
0
$cuerpo = $_POST['cuerpo'];
$imagen = $_POST['imagen'];
$fecha = $_POST['fecha'];
list($dia, $mes, $anio) = explode('-', $fecha);
$fecha = $anio . '-' . $mes . '-' . $dia;
/* INSERT */
include_once "classes/class.novedades.php";
$novedades = new novedades();
$novedades->titulo = $titulo;
$novedades->cuerpo = $cuerpo;
$novedades->fecha = $fecha;
if ($_FILES['imagen']['name'] != "") {
    include_once '../resources/class.upload.php';
    $yukle = new upload();
    $yukle->set_max_size(99999999);
    $yukle->set_directory('../../images-novedades');
    $yukle->set_tmp_name($_FILES['imagen']['tmp_name']);
    $yukle->set_file_size($_FILES['imagen']['size']);
    $yukle->set_file_type($_FILES['imagen']['type']);
    //random
    $random = substr(md5(rand()), 0, 6);
    $avatarname = $random . '_' . $_FILES['imagen']['name'];
    $nombre_final = str_replace(' ', '-', $avatarname);
    $yukle->set_file_name($nombre_final);
    $yukle->start_copy();
    $yukle->resize(620, 0);
    $yukle->set_thumbnail_name('tn_' . $nombre_final);
    $yukle->create_thumbnail();
    $yukle->set_thumbnail_size(300, 0);
    if ($yukle->is_ok()) {
        $imagen = $nombre_final;
<?
include "upload.inc.php";
include "setup.php";
// Defining Class
$yukle = new upload;

// Set Max Size
$yukle->set_max_size(180000);

// Set Directory
$yukle->set_directory("audio");

// Do not change
// Set Temp Name for upload, $_FILES['file']['tmp_name'] is automaticly get the temp name
$yukle->set_tmp_name($_FILES['userfile']['tmp_name']);

// Do not change
// Set file size, $_FILES['file']['size'] is automaticly get the size
$yukle->set_file_size($_FILES['userfile']['size']);

// Do not change
// Set File Type, $_FILES['file']['type'] is automaticly get the type
$yukle->set_file_type($_FILES['userfile']['type']);

// Set File Name, $_FILES['file']['name'] is automaticly get the file name.. you can change
$yukle->set_file_name($_FILES['userfile']['name']);

// Start Copy Process
$yukle->start_copy();

// If uploaded file is image, you can resize the image width and height