How to attach and download files

How to attach and download files

jyd0228jyd0228 Posts: 28Questions: 10Answers: 0
edited March 23 in TableTools

Hello,
I want to implement a function to attach and download files.
https://editor.datatables.net/examples/advanced/upload-many.html <- I found a way to attach multiple files from that link.(There is more than one file to be attached.)
I want to know how to download the attached file by clicking Download in the table.

Could you please let me know if there is a sample to download the attached files?

Answers

  • colincolin Posts: 12,659Questions: 0Answers: 2,164

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

  • jyd0228jyd0228 Posts: 28Questions: 10Answers: 0
    edited March 29

    'dbClean' function does not work when 'upload-many' is used.
    When I deleted uploaded file, it is deleted from the 'USERS_FILES' table,
    but not from the 'FILES' table.
    Can't I use 'dbClean' function in 'upload-many'?

  • allanallan Posts: 54,718Questions: 1Answers: 8,561 Site admin

    It should do, can you give me a link to a page showing the issue and also the PHP code you are using please?

    Thanks,
    Allan

  • jyd0228jyd0228 Posts: 28Questions: 10Answers: 0

    https://editor.datatables.net/examples/advanced/upload-many

    Add 'dbClean' here.

    .dbClean(async function(data) {
    for (let i = 0, ien = data.length; i < ien; i++) {
    await unlink(data[i].system_path);
    }
    return true;
    })

    If you delete the file after adding 'dbClean' and executing it, the file is deleted from the 'users_files' table, but not from the 'files' table.

Sign In or Register to comment.