Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
File POST from form after submit
  • Hi everyone, i need load a file into Database as BLOB.

    And i can't do it... Everyone can post an form example and controller procesation.

    Thanks
  • HarroHarro
    Accepted Answer
    Plain PHP example: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx

    For Fuel, you would ofcourse use the Upload class instead of accessing $_FILES directly.
  • Harro, I want use Fuel.

    Thanks for say me what is the right class to use. But, in the config example

        $config = array(
            'path' => DOCROOT.'files',
            'randomize' => true,
            'ext_whitelist' => array('img', 'jpg', 'jpeg', 'gif', 'png'),
        );

    this file is store in
     'path' => DOCROOT.'files'
    and i want store in BLOB field on Model_Product. For do this, i can set
    'path' => $product->sheetdata;

    Very thanks for your answers.



  • No, you need the Upload class to process and validate your uploaded file. This results of that will be a file on disk (preferably not in DOCROOT, but in a more secure place). Then you need to read the file into a variable, properly escape it, then assign it to $product->sheetdata, then save $product, and if that succeeds, delete the file from disk.

    The page I linked to is giving you some pointers.

    This is all not very Fuel related, this is general PHP knowledge. If you don't have that, try to find the answer online. That is how I found that link...

Howdy, Stranger!

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

In this Discussion