root

Changeset 459

Show
Ignore:
Timestamp:
01/05/09 22:13:14 (2 years ago)
Author:
wbond
Message:

Removed the dependency of fUpload on fRequest

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fUpload.php

    r448 r459 Hide Line Numbers
    33 * Provides validation and movement of uploaded files 
    44 *  
    5  * @copyright  Copyright (c) 2007-2008 Will Bond 
     5 * @copyright  Copyright (c) 2007-2009 Will Bond 
    66 * @author     Will Bond [wb] <will@flourishlib.com> 
    77 * @license    http://flourishlib.com/license 
     
    1010 * @link       http://flourishlib.com/fUpload 
    1111 *  
    12  * @version    1.0.0b1 
    13  * @changes    1.0.0b1  Fixed a bug with validating filesizes [wb, 2008-11-25] 
     12 * @version    1.0.0b3 
     13 * @changes    1.0.0b3  Removed the dependency on fRequest [wb, 2009-01-05] 
     14 * @changes    1.0.0b2  Fixed a bug with validating filesizes [wb, 2008-11-25] 
    1415 * @changes    1.0.0b   The initial implementation [wb, 2007-06-14] 
    1516 */ 
     
    2930    static public function check($field) 
    3031    { 
    31         if (fRequest::check($field) && $_SERVER['REQUEST_METHOD'] != 'POST') { 
     32        if (isset($_GET[$field]) && $_SERVER['REQUEST_METHOD'] != 'POST') { 
    3233            throw new fProgrammerException( 
    3334                'Missing method="post" attribute in form tag' 
     
    3536        } 
    3637         
    37         if (fRequest::check($field) && (!isset($_SERVER['CONTENT_TYPE']) || stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE)) { 
     38        if (isset($_POST[$field]) && (!isset($_SERVER['CONTENT_TYPE']) || stripos($_SERVER['CONTENT_TYPE'], 'multipart/form-data') === FALSE)) { 
    3839            throw new fProgrammerException( 
    3940                'Missing enctype="multipart/form-data" attribute in form tag' 
     
    285286         
    286287        if ($file_array['error'] == UPLOAD_ERR_FORM_SIZE || $file_array['error'] == UPLOAD_ERR_INI_SIZE) { 
    287             $max_size = (fRequest::get('MAX_FILE_SIZE')) ? fRequest::get('MAX_FILE_SIZE') : ini_get('upload_max_filesize'); 
     288            $max_size = (!empty($_POST['MAX_FILE_SIZE'])) ? $_POST['MAX_FILE_SIZE'] : ini_get('upload_max_filesize'); 
    288289            throw new fValidationException( 
    289290                'The file uploaded is over the limit of %s', 
     
    320321 
    321322/** 
    322  * Copyright (c) 2007-2008 Will Bond <will@flourishlib.com> 
     323 * Copyright (c) 2007-2009 Will Bond <will@flourishlib.com> 
    323324 *  
    324325 * Permission is hereby granted, free of charge, to any person obtaining a copy