Check for the existence of an uploaded file in PHP

Description

The following code shows how to check for the existence of an uploaded file.

Example


<?php/*w ww .  j ava2  s  .  c om*/

if (!is_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'])) {
    $error = "You must upload a file!";
    unlink($HTTP_POST_FILES['upload_file']['tmp_name']);
}

?>




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo