Check for corrupt files
- How-to
- Nathan Mitton
- PowerBuilder
- Wednesday, 21 February 2024 04:16 AM UTC
Hi everyone.
I am using PB 2019 R3 2703. We have a problem in our PB application with users being able to attach corrupt files. I want to be able to check whether a file is corrupt before I allow the attachment, but this is not as easy as I thought.
FileOpen succeeds (returns > 0) even when opening a corrupt file, so I can't use that to check. I've tried using ShellExecute, CreateProcess, etc but they also seem to indicate success on opening a corrupted file (I'm probably missing something). I'm playing around with OLE and that seems to be the most promising but even this has it's issues.
So my question is, does anyone out there know of an easy way to use PowerBuilder to determine whether a file is corrupted? If it makes any difference, I only need to check files of type .txt, .pdf, .jpg, .jpeg, .gif, .doc, .docx, .msg, .png, and .html.
Any advice would be greatly appreciated!
Thanks,
Nathan
(my first post to a PowerBuilder forum in many years. It is so good to be back on the PowerBuilder bus!)
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.