P.S - This code is with reference for your situation that file is Sent to PHP via a form having variable name fileToUpload in HTML code... You might Need to Change accordingly, because I don't know your whole code...