Hey everyone, Im quite new to programming so please be nice :)
I am currently experimenting with try-catch statements, I read the documentation on the php.net website and didn't find it all that helpful. I understand what they do, but from reading it, i would not be able to implement one into my own code. I need a real example to help me understand.
How could i turn this example into a try catch statement, if the upload was not successful.
$move = move_uploaded_file($_FILES['file']['tmp_name'], $_SERVER['DOCUMENT_ROOT']."/uploads/".$_FILES['file']['name']);
if (!$move) {
die ('File Didnt Upload');
} else {
//opens the uploaded file for extraction
echo "Upload Complete!";
}
This may not be a good example to work with, but any help would be appreciated :)
Thanks alot!