Check file type when upload - if JPEG do image process if PDF extension do not do the image processing

Check file type when upload - if JPEG do image process if PDF extension do not do the image processing

Upload a file to the server. I allow .pdf,.PDF.jpg,.png,.jpeg,.JPG,.PNG,.JPEG
When its an image … it must LOAD the and crop them as its doing… so that is sorted and working.
But i want to add a condition that if the file extension is PDF it must void the image processing.

Anybody that might have an idea… or add a condition to check the POST … eg… the file extension maybe

Can anybody point me in the correct direction please.

I have tried this… . condition… upload1.type != ‘.pdf’ then to only use the image processing…

also just tried upload1.type != ‘pdf’

but if i try a .pdf… the condition does not stop the image processor…

still-wants-to-process

You could try using the ends with formatter on either the file name or type, also I see your using the upload TYPE as .pdf is this what it actually returns never tried a pdf but images return like image/png etc

i think the TYPE is “file” but that applies to all files… eg … jpg… pdf…

So your idea… of getting the file name… and then using the “ends” with formatter might do the trick.

There’s a file/folder statistics actions step you can use. It returns loads of info, including the extension

1 Like

Mmmm @Sorry_Duh good… your idea about the formatter and ends worked like a charm.

Im sure there are many other ways… but it worked…

2 Likes

thanks @bpj Ben… im sure that will also work to get to some solution… but i have used the .ends formatter to check if the file is a pdf :slight_smile: and worked…

1 Like