Update upload.php

Added check_filename function to check filename from DB rather than directory. Added {}'s to ifs to avoid pulling an Apple