Is There A Way To Tell What Kind Of File

I Need Help, Ive Got A Multiple Files Column Setup And When Clients Upload Files, I have No Way Of Determining What Type Of File It Is And Im Curious To Find Out If Anyone Knows A Way To Find Out What Type A File Is After Its Been Uploaded?

What if a user uploads multiple different types of files into the same column? What would you expect to see? Something like this? txt,html,png

Yes Im Setting Up A Webhook Through Make To PDF.co

To Convert Csv And Excel Files To PDF, but Cant Distinguish between Them.

Better Yet, Is There A Way To Seperate File Type After Theyve Been Uploaded?

Figured It Out, created If Then Else Column To See If URL Includes

pdf
jpg
csv

this should allow me to choose which files get sent to get converted

Well, I had done this much, so in case you need it, here is javascript that will read through the urls and return a comma delimited list of unique file extensions.

All you need is a Joined List column to convert the Multiple Files column array into a comma delimited list of urls. Then a javascript column with the following code, passing the joined list as the p1 parameter. This will return a unique list of file extensions.

function extractUniqueFileExtensions(urls) {
    if (!urls) return ""; // Handle empty input

    return Array.from(
        new Set( // Use a Set to ensure uniqueness
            urls
                .split(",") // Split the URLs into an array
                .map(url => {
                    const match = url.trim().match(/\.([a-zA-Z0-9]+)(?=\?|#|$)/); // Regex to capture the file extension
                    return match ? match[1] : ""; // Extract extension or return an empty string if not found
                })
                .filter(ext => ext) // Remove empty strings
        )
    ).join(","); // Join the unique extensions into a comma-delimited list
}

return extractUniqueFileExtensions(p1);
3 Likes

Are you processing them all at once in PDF.co?

I assume you can iterate through an array in Make, and then just process those that are CSV and Excel?

1 Like

PDF.co allows you to send an array of links containing the pdfs

Like the links after files have been uploaded to glide

It downloads and creates a new pdf

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.