Upload_path parameter problem

Hi,

I'm using a file field type in a simple module. Using Fuel 1.3.1, this worked:

$fields['image_upload'] = array('order' => '10', 'type' => 'file', 'file_name' => 'image', 'label' => 'IMAGE', 'upload_path' => 'images/emissions/', 'overwrite' => TRUE, 'order' => 21);

After upgrading to 1.4.2 (fresh install, moving my files in and modifying manually) this doesn't work anymore. My files are uploaded to "assets/images" folder, no matter which subfolder I try to indicate in the "upload_path" parameter. I've tried using the "folder" parameter because I remember reading about it somewhere in the forum, no success.

I've tried specifying a full path by appending the destination folders to WEB_ROOT/WEB_PATH and the likes. Either no file gets uploaded or in some cases it defaults to the "assets/images".

I've been on this for a few hours and I know this should be simple. What am I doing wrong? Thanks for any help!

Comments

  • For the upload_path to work, the 'encryption_key' needs to be set in the main CI config file (fuel/application/config/config.php). Also, the path needs to be absolute if you are using the upload_path parameter (folder does not). So you would want assets_server_path('images/emissions');

  • YES! Thanks a bunch, I would've looked for that for quite a while.

    On a side note, I tried adding 'display_preview' => TRUE to my field, assuming I'd get a preview of the selected image beside the field in the form. I see nothing and nothing seems to be happening on the console. Does this require further configuration (or is it not meant for use in simple modules)?

  • Instead of naming the field "image_upload", just name it "image". The field creates some hidden fields with the "_upload" suffix already. Additionally, I ran into a bug when saving on the Pages model that I fixed in the develop branch:
    https://github.com/daylightstudio/FUEL-CMS/commit/6a9e7022010caef4d1f91639ff45caf4cb0cc520

Sign In or Register to comment.