PHP: Upload images from client machine to the server

Click here for Govt Schemes

PHP: Upload images from client machine to the server

Will the example from the manual page for move_uploaded_file() do?

$uploads_dir = '/uploads';
foreach ($_FILES["pictures"]["error"] as $key => $error) {
    if ($error == UPLOAD_ERR_OK) {
        $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
        $name = $_FILES["pictures"]["name"][$key];
        move_uploaded_file($tmp_name, "$uploads_dir/$name");
    }
}

Also see the chapter on Handling File Uploads in the PHP Manual



Share on Pinterest
Share on LinkedIn
Share on WhatsApp
Share on Telegram



Latest POst

Recent Updates


Haryana Goverment Schemes