user246392
user246392

Reputation: 3027

Azure Storage: How to check if a blob represents a valid image

I provide users with a SAS token to upload blobs. I'd like to check whether the blobs represent a valid image or not. How can I do this? In the SAS token, I make sure the blob name ends with a jpeg extension, but this does not mean the users upload an image since everything is uploaded as a byte stream.

Upvotes: 0

Views: 530

Answers (2)

Sadiq Khoja
Sadiq Khoja

Reputation: 600

You can write an Azure Function that will be triggered every time a new blob is uploaded. And in that function you can validate if the blob is a valid image file, if it is not then you can delete it or send an email to uploader.

Upvotes: 0

Sajeetharan
Sajeetharan

Reputation: 222720

This is Not possible as described here. Perhaps, the better way to validate is at the front end when the user tries to upload the file.

Upvotes: 1

Related Questions