当前位置: 首页>>代码示例>>PHP>>正文


PHP upload::set_file_size方法代码示例

本文整理汇总了PHP中upload::set_file_size方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::set_file_size方法的具体用法?PHP upload::set_file_size怎么用?PHP upload::set_file_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在upload的用法示例。


在下文中一共展示了upload::set_file_size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: upload

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);
}
开发者ID:jasmith152,项目名称:Green_Jewelers,代码行数:45,代码来源:upload.php

示例2: explode

$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;
    } else {
        //si hay error cargo sin imagen
开发者ID:EzequielDot175,项目名称:nufarm,代码行数:31,代码来源:c_usuario.php

示例3: upload_file

 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;
 }
开发者ID:hubermann,项目名称:battista,代码行数:53,代码来源:productos.php

示例4: upload

    $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;
    } else {
        //si hay error cargo sin imagen
开发者ID:EzequielDot175,项目名称:mknet,代码行数:31,代码来源:c_producto.php

示例5: upload_file

 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;
 }
开发者ID:hubermann,项目名称:enlobos,代码行数:59,代码来源:lugares.php

示例6: explode

$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;
        $novedades->imagen = $imagen;
    } else {
开发者ID:EzequielDot175,项目名称:mknet,代码行数:31,代码来源:c_novedad.php

示例7:

// 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
// Support gif, jpg, png
//$yukle->resize(0,0);
开发者ID:nuthankumarns,项目名称:Edulab-web-services,代码行数:30,代码来源:upload.php


注:本文中的upload::set_file_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。