views:

168

answers:

1
A: 

Have you checked the PHP and/or server error logs? Perhaps PHP's max upload size and/or an Apache-type LimitRequestBody is limiting upload file size and you're exceeding it.

You should also check the $_FILES['uploaded']['error'] value, which will contain the error code for the upload operation. Never assume that the upload succeeded... you should be doing at least the following:

if($_FILES['uploaded]['error'] === UPLOAD_ERR_OK) {
   ... handle upload here...
} else {
   ... handle error condition here ...
}

The full suite of error constants is defined here in the PHP docs.

Oh, and be aware that your code is vulnerable to filename collisions. You will be overwriting existing files if one with the same basename is uploaded. Perhaps this is what you intended, but just a friendly warning.

Marc B