Troubleshooting file upload error code 4
Try:
foreach ($_FILES["uploadedfile"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { echo "$error_codes[$error]"; move_uploaded_file( $_FILES["uploadedfile"]["tmp_name"][$key], $target_path ) or die("Problems with upload"); } }
Well its going to fail as you want to upload MULTIPLE files, but your code is only designed to handle 1 single file.
Go ahead and read through how to handle multiple files here:
http://php.net/manual/en/features.file-upload.multiple.php