My guess is that you are getting that warning from not declaring a scalar that is being used. Perhaps you did not declare $upload or $filename. This would explain both the warning, and the problem opening the file.