I don't know if it will help you, but I leave these in case it helps someone, make this query to be able to put together a download link of a file just by clicking download the document.
SELECT ID, Name, document, concat("http://localhost/test/files/",'',replace(replace(SUBSTRING_INDEX(SUBSTRING_INDEX(document, 'files', -1), '",', 1),'/' ,'' ),'\\' ,'')) as link FROM documents