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


PHP FileUpload::getExtension方法代码示例

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


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

示例1: editCuadro

 private static function editCuadro($gestor, $sesion)
 {
     $obra = new Obra();
     $obra->read();
     $pkID = Request::post("pkID");
     $nombre = Request::post("nombre");
     $email = Request::post('email');
     $usuario = $sesion->getUser();
     $obra->setId_usuario($usuario);
     /*Subir fotografia*/
     $subir = new FileUpload("nuevaImagen");
     $subir->setDestino("../../controlUsuario/cuadros/{$usuario}/");
     $subir->setTamaño(100000000);
     $subir->setNombre($nombre);
     $subir->setPolitica(FileUpload::REEMPLAZAR);
     if ($subir->upload()) {
         echo 'Archivo subido con éxito';
         $obra->setImagen($nombre . "." . $subir->getExtension());
     } else {
         echo 'Archivo no subido';
     }
     $obra->setImagen($nombre . "." . $subir->getExtension());
     $r = $gestor->set($obra, $pkID);
     echo $r;
     //header("Location:index.php?op=edit&r=$r");
 }
开发者ID:jjorgosogarcia,项目名称:PhpGaleria,代码行数:26,代码来源:ControladorObra.php

示例2: function

        $manager = new OpenSubtitles\SubtitlesManager();
        $sub = $manager->downloadSubtitle($path, $name);
        $response = Response::json(array('result' => true, 'data' => $sub));
        $response->header('Content-Type', 'application/json');
        return $response;
    }
});
Route::post('get/subs/file', function () {
    if (Auth::guest()) {
    } else {
        require '/opt/nginx/html/vendor/upload.php';
        $upload_directory = '/opt/nginx/html/public/uploads/subs';
        $allowed_extensions = array('srt');
        $max_size = 1048576;
        $uploader = new FileUpload('file');
        $ext = $uploader->getExtension();
        if (empty($ext)) {
            $response = Response::json(array('result' => false, 'location' => false, 'error' => 'Invalid file type.'));
            $response->header('Content-Type', 'application/json');
            return $response;
        }
        $filename = uniqid(uniqid(), true) . '.' . $ext;
        $uploader->newFileName = $filename;
        $uploader->sizeLimit = $max_size;
        $result = $uploader->handleUpload($upload_directory, $allowed_extensions);
        $errors = $uploader->getErrorMsg();
        if (!empty($errors)) {
            $response = Response::json(array('result' => false, 'location' => false, 'error' => $uploader->getErrorMsg()));
            $response->header('Content-Type', 'application/json');
            return $response;
        }
开发者ID:naveengamage,项目名称:okaydrive,代码行数:31,代码来源:routes.php

示例3: FileUpload

$plantilla = Request::post('plantillas');
$activacion = sha1($nuevoCorreo . Constant::SEMILLA);
foreach ($usuarios as $indice => $usuario) {
    if ($correo == $usuario->getEmail() && $nuevoCorreo != $usuario->getEmail()) {
        $usuarios2->setActivo(0);
        $r = $gestor->set($usuarios2, $correo);
        $enviarMail->sendActivationMail2($nuevoCorreo, $titulo, "{$titulo}  https://galeria-jjorgosogarcia.c9users.io/controlUsuario/phpActivarCorreo.php?correo={$nuevoCorreo}&activacion={$activacion}");
        // header("Location:../usuario/confirmacion.php?op=mail");
    } else {
        $usuarios2->setActivo(1);
    }
}
/*Subir fotografia*/
$subir = new FileUpload("nuevaImagen");
$subir->setDestino("../controlUsuario/avatares/");
$subir->setTamaño(100000000);
$subir->setNombre($correo);
$subir->setPolitica(FileUpload::REEMPLAZAR);
if ($subir->upload()) {
    echo 'Archivo subido con éxito';
    $usuarios2->setImagen($correo . "." . $subir->getExtension());
} else {
    echo 'Archivo no subido';
}
$usuarios2->setPlantilla($plantilla);
$pkID = Request::post("pkID");
$r = $gestor->set($usuarios2, $pkID);
$bd->close();
echo $r;
var_dump($bd->getError());
//header("Location:../acceso/indexBaja.php?op=edit&r=$r");
开发者ID:jjorgosogarcia,项目名称:PhpGaleria,代码行数:31,代码来源:phpedit.php

示例4: json_encode

require '../../extras/Uploader.php';
require_once '../../../../configuracao_servidor.php';
// Directory where we're storing uploaded images
// Remember to set correct permissions or it won't work
//$upload_dir = dirname(__FILE__) . '/upload_files/';
//$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/tcc/images/uploads/logos/';
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
//Path para o endereco base do servidor
if ($_SERVER["REMOTE_ADDR"] == '127.0.0.1') {
    $server_root = $_SERVER["DOCUMENT_ROOT"] . '/tcc/';
} else {
    $server_root = $pasta_upload;
    // vem do arquivo de configuracao do servidor
}
$upload_dir = $server_root . '/images/uploads/logos/';
$uploader = new FileUpload('uploadfile');
$novo_nome = md5(uniqid(rand(), true)) . '.' . $uploader->getExtension();
$uploader->newFileName = $novo_nome;
// Handle the upload
$result = $uploader->handleUpload($upload_dir);
if (!$result) {
    exit(json_encode(array('success' => false, 'msg' => $uploader->getErrorMsg())));
}
require_once $server_root . '/libs/Model/Miniatura.php';
$pasta = $upload_dir;
$img_name = $novo_nome;
createthumb($pasta . $img_name, $pasta . 'small/' . $img_name, 320, 320, false, true, false);
createthumb($pasta . $img_name, $pasta . 'medium/' . $img_name, 720, 720, false, true, false);
createthumb($pasta . $img_name, $pasta . 'large/' . $img_name, 1000, 1000, false, true, false);
echo json_encode(array('success' => true, 'img' => $uploader->newFileName));
开发者ID:joaoricardorm,项目名称:tcc,代码行数:31,代码来源:file_upload.php

示例5: htmlspecialchars

<?php

require 'Uploader.php';
//try to get the directory from the request
$dir = htmlspecialchars($_GET["dir"]);
//if it is null
if ($dir === null || $dir === "") {
    echo json_encode(array('success' => false, 'msg' => $Upload->getErrorMsg()));
    return;
} else {
    if ($dir === "files") {
        $upload_dir = '././Content/files/';
        //$valid_extensions = array('adi', 'txt', 'cabrillo.txt', 'log', 'cbr');
    } else {
        echo json_encode(array('success' => false, 'msg' => $Upload->getErrorMsg()));
        return;
    }
}
$Upload = new FileUpload('uploadfile');
$ext = $Upload->getExtension();
// Get the extension of the uploaded file
$time = time();
$Upload->newFileName = $time . '.' . $ext;
//$result = $Upload->handleUpload($upload_dir, $valid_extensions);
$result = $Upload->handleUpload($upload_dir);
if (!$result) {
    echo json_encode(array('success' => false, 'msg' => $Upload->getErrorMsg()));
} else {
    echo json_encode(array('success' => true, 'file' => $Upload->getFileName(), 'timestamp' => $time));
}
开发者ID:4x6hp,项目名称:IARC,代码行数:30,代码来源:uploadHandler.php

示例6: User

$usuarios = new User();
$usuarios->read();
/*$usuarios->setActivo(0);
$usuarios->setAdministrador(0);
$usuarios->setPersonal(0);
*/
/*Crear Alias*/
$correo = Request::post("email");
$alias = explode("@", $correo);
$usuarios->setAlias($alias[0]);
/*Creamos la fecha de registro*/
$time = time();
$fecha = date("Y-m-d", $time);
$usuarios->setFechaalta($fecha);
/*Subir fotografia*/
$subir = new FileUpload("imagen");
$subir->setDestino("./avatares/");
$subir->setTamaño(100000000);
$subir->setNombre($correo . "." . $subir->getExtension());
$subir->setPolitica(FileUpload::REEMPLAZAR);
if ($subir->upload()) {
    echo 'Archivo subido con éxito';
} else {
    echo 'Archivo no subido';
}
$usuarios->setImagen($correo . "." . $subir->getExtension());
$r = $gestor->insert($usuarios);
$bd->close();
//echo $r;
//var_dump($bd->getError());
header("Location:../admin/index.php?op=añadido&r={$r}");
开发者ID:jjorgosogarcia,项目名称:usuarios,代码行数:31,代码来源:phpinsert.php

示例7: array

<?php

$allowed_extensions = array("gif", "jpg", "jpeg", "png");
// Directory where we're storing uploaded images
$upload_dir = './upload_files';
$upload_name = 'file_' . date("Y-m-d_His.");
if (isset($_GET['file_tree'])) {
    include dirname(__FILE__) . "/extras/php_file_tree.php";
    die(php_file_tree($upload_dir, "javascript:shoWImg('[link]',[id])", $allowed_extensions));
}
if (isset($_GET['uploadfile'])) {
    require dirname(__FILE__) . '/extras/Uploader.php';
    $Upload = new FileUpload('uploadfile');
    $ext = $Upload->getExtension();
    // Get the extension of the uploaded file
    $Upload->newFileName = $upload_name . $ext;
    $result = $Upload->handleUpload($upload_dir, $allowed_extensions);
    if (!$result) {
        die(json_encode(array('success' => false, 'msg' => $Upload->getErrorMsg())));
    } else {
        die(json_encode(array('success' => true, 'FileName' => $Upload->getFileName(), 'Size' => $Upload->getFileSize(), 'SavedFile' => $Upload->getSavedFile(), 'Extension' => $Upload->getExtension())));
    }
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>تحميل الملفات</title>
	
开发者ID:onexite,项目名称:Ajax-Uploader,代码行数:30,代码来源:index.php

示例8: insertSet

 private static function insertSet()
 {
     $bd = new BaseDatos();
     $gestor_galeria = new ManageGallery($bd);
     $sesion = new Session();
     $artista = self::getArtist($sesion);
     $descripcion = Request::post("descripcion");
     $id = Request::post("id");
     $file = new FileUpload("imagen");
     var_dump($gestor_galeria->count());
     $nombre = $artista->getGaleria() . "_" . ($gestor_galeria->count() + 1) . sha1($file->getNombre());
     $file->setNombre($nombre);
     $file->setDestino("../img/");
     $file->setTamanio(52428800);
     $file->getPolitica(FileUpload::RENOMBRAR);
     $file->addTipo("gif");
     $file->upload();
     $imagen_ruta = "../img/" . $file->getNombre() . "." . $file->getExtension();
     $gallery = new Gallery($id, 0, $imagen_ruta, $descripcion);
     $r = $gestor_galeria->insert($gallery);
     header("Location:?op=insert&r={$r}&action=read&do=View#section3");
 }
开发者ID:ealvarez1990,项目名称:galeriaarte,代码行数:22,代码来源:ControladorArtist.php

示例9: saveFile

 /**
  * Will save the image file as it is [If we only need to upload image without creating the thumbnails]
  *
  * @param file $file_element
  * @param string $module_name
  * @param integer $record_id
  * @param string $file_upload_path
  * @param string $filename
  */
 public function saveFile($file_element, $module_name = "", $record_id, $file_upload_path, $is_main_resize = false, $is_thumbnail = false)
 {
     $fileObj = new FileUpload();
     $fileObj->doInitialize($file_element);
     $filename = substr($file_element['name'], 0, strrpos($file_element['name'], '.'));
     $filename = $module_name . "_" . $record_id . $fileObj->getExtension();
     $fileObj->setName($filename);
     $fileObj->saveAs($file_upload_path);
     //to save the file physically on given location
     $savedImgPath = $fileObj->getFullPath();
     //This holds the full path of the file
     if ($is_main_resize) {
         $mainResize = PhpThumbFactory::create($savedImgPath);
         $mainResize->resize($this->mWidth, $this->mHeight);
         $mainResize->save($file_upload_path . $fileObj->getName());
     }
     if ($is_thumbnail) {
         $thumb = PhpThumbFactory::create($savedImgPath);
         //$thumb->adaptiveResize(80, 80);
         $thumb->resize($this->mThumbWidth, $this->mThumbHeight);
         $thumb->save($file_upload_path . "thumbnail/" . $fileObj->getName());
     }
     return $filename;
 }
开发者ID:PropertBlast,项目名称:property_blast,代码行数:33,代码来源:ImageUpload.php

示例10: dirname

<?php

include '../../../../../../wp-load.php';
require dirname(__FILE__) . '/php/Uploader.php';
//
$upload_dir = dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))) . '/uploads/ssuploader/';
if (!is_dir($upload_dir)) {
    mkdir($upload_dir);
}
$uploader = new FileUpload('uploadfile');
$uploader->newFileName = sanitize_file_name($uploader->getFileName()) . '_' . rand(0, 10) . '.' . $uploader->getExtension();
$result = $uploader->handleUpload($upload_dir);
//
switch ($_GET['uploadType']) {
    case 'cv':
        if (!$result) {
            exit(json_encode(array('success' => FALSE, 'msg' => $uploader->getErrorMsg())));
        } else {
            ///
            $cv_url = SURL . '/wp-content/' . explode('wp-content', $uploader->getSavedFile())[1];
            $attach_id = xsUTL::add_image($cv_url);
            if ($attach_id > 0) {
                echo json_encode(array('status' => TRUE, 'id' => $attach_id));
            } else {
                echo json_encode(array('status' => TRUE, 'msg' => 'File Upload Failed.Please try again'));
            }
        }
        die;
        break;
}
// Directory where we're storing uploaded images
开发者ID:gpsidhuu,项目名称:alphaReputation,代码行数:31,代码来源:file_upload.php

示例11: uploadFile

 public function uploadFile()
 {
     $requestsPerHour = 60;
     $key = sprintf('api:%s', Request::getClientIp());
     $get_data = DB::table('limit')->where('ip', $key)->first();
     if (isset($get_data->ip)) {
         $count = $get_data->count;
         $count++;
         DB::table('limit')->where('ip', $key)->update(array('count' => $count));
     } else {
         DB::table('limit')->insert(array('user_id' => Auth::user()->id, 'ip' => $key, 'count' => 0));
     }
     $count = UserMedia::where('user_id', '=', Auth::user()->id)->where('is_deleted', '=', '0')->where('cat', '=', '1')->count();
     //if($count >= 2 && Auth::user()->category_id == 1){
     //	$response = Response::json(array('result'=>false, 'location' => false,'error'=>'Free accounts are only allowed 2 torrents per account.' ));
     //	$response->header('Content-Type', 'application/json');
     //	return $response;
     //}
     $user_media = UserMedia::where('user_id', '=', Auth::user()->id)->where('is_deleted', '=', '0')->get();
     if (count($user_media) != 0) {
         $uma = array();
         foreach ($user_media as $um) {
             array_push($uma, $um->media_id);
         }
         $media_count = Media::whereIn('id', $uma)->where('state', '!=', 'done')->where('state', '!=', 'max_pause')->where('state', '!=', 'failed')->where('state', '!=', 'process')->where('state', '!=', 'stop')->count();
         if ($media_count >= 1 && Auth::user()->category_id == 1) {
             $response = Response::json(array('result' => false, 'location' => false, 'error' => 'Free accounts are only allowed 1 active torrent per account.'));
             $response->header('Content-Type', 'application/json');
             return $response;
         }
         if ($media_count >= 10) {
             $response = Response::json(array('result' => false, 'location' => false, 'error' => 'Your account is only allowed 10 active torrents.'));
             $response->header('Content-Type', 'application/json');
             return $response;
         }
     }
     if (Auth::user()->category_id == 1) {
         $status = true;
         $useage = Auth::user()->used_bytes;
         if ($useage > Auth::user()->avl_bytes) {
             $status = false;
         }
         if (Auth::user()->avl_bytes - $useage < 104857600) {
             $status = false;
         }
         date_default_timezone_set('Pacific/Auckland');
         $ip_date = date("Y-m-d");
         $ip_bytes = DataIp::where('ip', '=', $_SERVER['REMOTE_ADDR'])->where('date', '=', $ip_date)->sum('bytes');
         if (1073741824 - $ip_bytes < 104857600) {
             $status = false;
         }
         if (!$status) {
             $response = Response::json(array('result' => false, 'location' => false, 'error' => 'Low bandwidth left on your account. Upgrade your account to premium.'));
             $response->header('Content-Type', 'application/json');
             return $response;
         }
     }
     require '/opt/nginx/html/vendor/upload.php';
     $upload_directory = '/opt/nginx/html/public/cache/tmp';
     $allowed_extensions = array('torrent');
     $max_size = 1048576;
     $uploader = new FileUpload('file');
     $ext = $uploader->getExtension();
     if (empty($ext)) {
         $response = Response::json(array('result' => false, 'location' => false, 'error' => 'Invalid file type.'));
         $response->header('Content-Type', 'application/json');
         return $response;
     }
     $filename = uniqid(uniqid(), true) . '.' . $ext;
     $uploader->newFileName = $filename;
     $uploader->sizeLimit = $max_size;
     $result = $uploader->handleUpload($upload_directory, $allowed_extensions);
     $errors = $uploader->getErrorMsg();
     if (!empty($errors)) {
         $response = Response::json(array('result' => false, 'location' => false, 'error' => $uploader->getErrorMsg()));
         $response->header('Content-Type', 'application/json');
         return $response;
     }
     $file = $uploader->getSavedFile();
     $url = 'http://s01.okaydrive.com/rt/php/addtorrent2.php';
     $myvars = 'torrents_start_stopped=1&url=https://okaydrive.com/cache/tmp/' . $filename;
     $ch = curl_init($url);
     $username = 'datalinktunnel';
     $password = 'T52UamGTrmCCGn4fJgyq';
     curl_setopt($ch, CURLOPT_USERPWD, $username . ":" . $password);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $myvars);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($ch);
     $json = json_decode($response, true);
     $uni_id = '';
     if ($json["result"] == "success") {
         $hash = $json["hash"];
         $mediaexist = Media::where('hash', '=', $hash)->first();
         if (isset($mediaexist->id)) {
             if ($mediaexist->state == 'done' || $mediaexist->state == 'failed') {
                 $url = 'http://s01.okaydrive.com/rt/plugins/httprpc/action.php';
                 $myvars = 'mode=remove&hash=' . $mediaexist->hash;
//.........这里部分代码省略.........
开发者ID:naveengamage,项目名称:okaydrive,代码行数:101,代码来源:MediaController.php


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