
Yakim - 2013-02-06 08:11:14
if (@file_exists($this->folder . sha1_file($this->tmp_name) . time() . $this->name))
{
$this->error = 3;
Because sha1_file() is an expensive operation, and the target directory may contain (for instance) 1000+ huge PDF files... better if the code would perform comparison based ONLY the filesize. If an identical-sized file is found, perform sha1_file() comparison between that file and the uploaded file.
Also, a hardcoded error3 string is not useful.
Included in the error message should be the filename of the identical, pre-existing file.