I am writing a PHP script that will sit on a server running in Amazon EC2. It will receive uploaded files, create a record in the database, rename the file to match database id, resize the file, move the file to a new location on server and also PUT the image file on Amazon S3.
At each of these stages there is the possibility of failure which will cause the script to interrupt and if the user is uploading many files the next file will waiting will not be uploaded.
So at each of these activities I know I need to catch any errors, record them to be dealt with later and move on to the next image, or report back that a problem has occurred.
I think I want to record failed uploads in my database so that i can get a report of when uploads failed, and record the filename, the username of the uploader and any other info that will allow me to contact the user or if it was at the resize stage that the error occurred for example, resize the image and put it on Amazon S3.
I am not a very experienced PHP coder, are Try Catch blocks suitable for all the above situations. Should I use Try Catch for rename()?
cheers