Changeset 19391


Ignore:
Timestamp:
12/10/12 22:57:10 (7 years ago)
Author:
plg
Message:

Better management on error code/message provided by PHP on file upload

No need to add a MAX_FILE_SIZE limit on HTML form, it makes the error
message less readable than the specific PHP error message.

Location:
extensions/PersoFavicon/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/PersoFavicon/admin/admin.php

    r10632 r19391  
    4949$content_dir = PHPWG_ROOT_PATH.PWG_LOCAL_DIR;    
    5050$tmp_file = $_FILES['pfi']['tmp_name']; 
     51 
     52if ($_FILES['pfi']['error'] !== UPLOAD_ERR_OK) 
     53{ 
     54  include_once(PHPWG_ROOT_PATH .'admin/include/functions_upload.inc.php'); 
     55  $error_message = file_upload_error_message($_FILES['pfi']['error']); 
     56  array_push( $page['errors'], $error_message); 
     57  break; 
     58} 
     59 
    5160  if( !is_uploaded_file($tmp_file) ) 
    5261    { 
  • extensions/PersoFavicon/admin/admin.tpl

    r7767 r19391  
    1212                        <fieldset> 
    1313                                <legend>{'pfi_select'|@translate}</legend> 
    14                                         <input type="hidden" name="MAX_FILE_SIZE" value="5120"> 
    1514                                        <input class="file" name="pfi" type="file" value=""> 
    1615                <br>     
Note: See TracChangeset for help on using the changeset viewer.