Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
upload eror
  • I'm using the upload class, I'm uploading some pdf file, it works perfectly with some documents and does' work with other...? all documents are on the same folder. I check the uploading max size, is set to 'max_size'=> 0, so it means 'no limit size', my php.ini allow 8Mo and my doc is only 6Mo.
    I tried to read the error array but it only sand me '11' as an answer, no error message... foreach (Upload::get_errors() as $file)
    { $document= print_r($file);
    $document.= $file; // $file is an array with all file information,
    // $file contains an array of all error occurred
    // each array element is an an array containing 'error' and 'message'
    } can someone had the similar error? or have an advise for this one.
    thank you
  • There is no "error 11". PHP standard errors go from 1 to 8, Upload class errors start at 101. Can you dump $_FILES, Upload::get_files() and Upload::get_errors()?
  • yes, var_dump($file); gives array(10) {
    ["name"]=>
    string(30) "Revue de presse_2011-12-12.PDF"
    ["type"]=>
    string(0) ""
    ["error"]=>
    bool(true)
    ["size"]=>
    int(0)
    ["field"]=>
    string(8) "document"
    ["key"]=>
    bool(false)
    ["file"]=>
    string(0) ""
    ["errors"]=>
    array(1) {
    [0]=>
    array(2) {
    ["error"]=>
    int(1)
    ["message"]=>
    NULL
    }
    }
    ["extension"]=>
    string(3) "PDF"
    ["filename"]=>
    string(26) "Revue de presse_2011-12-12"
    }
  • and what does $_FILES contain (before calling Upload::process()).
  • you mean: var_dump($file);
    // process the uploaded files in $_FILES
    Upload::process($config); it send:
    ErrorException [ Notice ]: Undefined variable: file
  • no, not $file. I wrote $_FILES. I want to know what PHP thinks is uploaded. And with that dump I can "fake" your upload here and test the Upload class.
  • array(1) {
    ["document"]=>
    array(5) {
    ["name"]=>
    string(30) "Revue de presse_2011-12-12.PDF"
    ["type"]=>
    string(0) ""
    ["tmp_name"]=>
    string(0) ""
    ["error"]=>
    int(1)
    ["size"]=>
    int(0)
    }
  • Ok, So PHP already reports error 1 on the upload. After processing, this is the result of the Upload class:
    array
      'name' => string 'Revue de presse_2011-12-12.PDF' (length=30)
      'type' => string '' (length=0)
      'error' => boolean true
      'size' => int 0
      'field' => string 'document' (length=8)
      'key' => boolean false
      'file' => string '' (length=0)
      'errors' => 
        array
          0 => 
            array
              'error' => int 1
              'message' => string 'The uploaded file exceeds the upload_max_filesize directive in php.ini' (length=70)
      'extension' => string 'PDF' (length=3)
      'filename' => string 'Revue de presse_2011-12-12' (length=26)
    

    which is consistent. Error 1 = UPLOAD_ERR_INI_SIZE.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion