Validating custom fields before post save

In my experience, the only way to check the values of the fields is by directly accessing the $_POST vars:

if( ( isset( $_POST['upload_image'] ) && !empty( $_POST['upload_image'] ) )

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)