Closed saadiy2309 closed 5 years ago
So your Relation is
One to many ?
Main->Attachment
Can you give some further information, maybe your Code?
So I have Main and Attachments table. Initially I wanted to upload more than one file per main model so I created Attachment table with id, main_id, url when I upload 2-3 document(word, excel, pdf, etc,.) files should be uploaded and their urls should be written in attachments table with proper main_id. when I render view of Main model attachments should be rendered together
@saadiy2309 have you seen this? https://github.com/2amigos/yii2-file-upload-widget/issues/7#issuecomment-57300547
Instead of using the manager to save to S3 (as on the example) simply save it on local (I highly recommend you to use https://github.com/2amigos/yii2-flysystem-component to ease the task to work with files) and then save the path to the database.
Hey guys does anyone have any open source project implemented 2amigos file upload widget for educational purposes. p.s. I am in need of sample for uploading multiple files I have 2 model: Main and Attachments Attachments model has three attributes: id, main_id, url
When added widget's form into my Main/create form how do I make the widget to write file's url to Attachments table? Do I need to insert widget's upload function into Main's create function. By the way I am totally new to yii2