Get original Documents/Notes pdf saved as files without extensions

Hi.

When I create notes for users and add documents to the note, this documents (pdf, xls...) are saved in upload folder as files without extension. If I download this documents from web I can download it as the original pdf. But I need to extract the pdf from the files with a .php script because I need to download a lot of documents and I can't  download all one by one. So I want to take the files from upload folder and take the files I need. But as I said this files are saved without extensions.

My goal is create a .php script to take all this files, but I don't know how extract the original .pdf or .xls from this files saved without extension. How I can download with a php script the original .pdf from this files without extenson?

Thanks.

  • Hi ,

    Easiest solution for this question via api urls modifications.

    Simply login your instance and create small JS script in the Console of Chrome Developer Tools that would iterate the GUIDs you have.

    The urls must be look like below

    https://<YOUR_SUGARCLOUD_DOMAIN>/rest/v11_16/Notes/<REPLACE_THE_NOTE_GUID_PROGRAMATICALLY>/file/filename?force_download=1&1662543102890=1&platform=base

    Note: The field name and the module in this api is "fieldname" of Notes modules which is stock field. If anyone who is looking for this for a custom field for custom module then the field name and module name must be replaces with yours. 

    Let me know if this helps. 

    Tev.