[File Upload Many] one upload table serve several tables

[File Upload Many] one upload table serve several tables

williewillie Posts: 4Questions: 2Answers: 0

Hi,

is it possible that share 1 table to store all of the upload files? e.g. employees table, company table, post table.. etc, all of these tables provided a same function to let admin upload some files(many) to particular table.

In the file upload (many) example, it needs create user_file table, and file table for one module.

This question has an accepted answers - jump to answer

Answers

  • williewillie Posts: 4Questions: 2Answers: 0

    can I implement as followings

    users - users_files - files
    posts - posts_files - files
    comment - comment_file - files
    
  • williewillie Posts: 4Questions: 2Answers: 0

    OK, I tried the above solution, it can share the file table for all of other table, but it needs a multi to multi table for the linkage

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    For 1-1 links then yes, you can use the same link table (or even no link table - just a left join). But for an Mjoin a link table per connection is indeed preferred.

    The reason for that is how Mjoin does an "edit". Its not actually an edit, but rather a delete and then insert of the new data. So any meta information would be lost.

    Allan

This discussion has been closed.