Upload Multiple Files of Different Types
I have tried to follow the Creating Simple Modules tutorial, but amending it to handle uploading two mp3s and an image. Have got no idea where to start.
Have tried with just a single mp3 file which works (select in form and saves value in database) but then can not access the value; inside of track_model extends data_record, $this->track_path.
Any and all help appreciated
Comments
Also, I'll point out that there is a "editable_asset_filetypes" FUEL configuration value that determines what file types can be uploaded to which folders if you are not familiar with it:
http://www.getfuelcms.com/user_guide/general/configuration
Am handling the files in the on_after_post($values) method then just doing a simple check;
E.g. if (isset($_FILES['track']) && $_FILES['track']['size'] > 0) { ... }
$fields['icon']['class'] = 'asset_select icons/tracks'; $upload_path = assets_server_path('tracks/icons', 'media'); $fields['icon'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwrite' => FALSE);
But when I check my server it appears to retain the original name (even though a file of that name already exists).
Assuming if it did work OK, how would I access the new name, would it still be though the $values array?
https://github.com/daylightstudio/FUEL-CMS/commit/8b2999d9453940bd995d895109695a8c6607ad7b
To access the upload information, there is an "upload_data" array property that you can access in the "on_after_post" hook:
function on_after_post() { print_r($this->upload_data); }