This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi all. I'm back again. I want to know if this is possible. Can I create a fileupload on the fly and attach that fileupload to a model by it's id? To elaborate, I want someone to upload a file using a regular fileupload input instead of the fileupload widget. Once they do upload a file, it should attach itself to the model using the model's particular/selected id. here is the code I'm using:
My created plugin is Post
This is for my file upload and attachment on index.php (in the controller) for the Post Controller:
<?= Form::open(['files' => true]) ?>
<!--File Input-->
<input type="file" name="file">
<!--File Input-->
<button
type="submit"
class="btn btn-primary"
data-request="onScans"
data-request-confirm="Are you sure you want to import the selected file?"
data-popup-load-indicator>Attach Document To This Number</button>
<?= Form::close() ?>
I'm not even sure where to begin attaching this to a selected model id. Any help will be appreciated. As a note, I do not have any attachments in the Post Model for file uploads because I want to make the attachments in the controller if it's possible. The onScans method that I'm calling to is empty and I would like to do all my operations there for this scenario.
Thanks in advance!
Last updated
1-2 of 2