Bad Programmer
Bad Programmer

Reputation: 3752

Getting Content of PHP file upload error

I am working with the move_uploaded_file() function in PHP. I've managed to successfully troubleshoot a problem I was encountering, but I would like to be able to get the actual content of the warnning or error message. According to php.net (http://php.net/manual/en/function.move-uploaded-file.php) the move_uploaded_file() function returns FALSE and a warning on failure. I want the actual content of the warning, such as "failed to open stream: Permission denied..." so that I can record which errors are occurring. Is there a way to do this?

Upvotes: 4

Views: 18640

Answers (1)

Fenec
Fenec

Reputation: 1222

You can do using this: $_FILES['userfile']['error']

More info: http://php.net/manual/en/features.file-upload.errors.php

Upvotes: 11

Related Questions