January 27, 2011

HOW TO UPLOAD IMAGES IN YOUR FOLDER

<?php
    if(isset($_REQUEST['upload']))
    {
        if ((($_FILES["file"]["type"] == "image/gif")
            || ($_FILES["file"]["type"] == "image/jpeg")
            || ($_FILES["file"]["type"] == "image/pjpeg")))
           
        {
            //include("connection.php");       
            move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]);               
        } 
    }
?>

<html>
<head></head>
<body>
<form method="post" enctype="multipart/form-data">
    <table border=1>
        <tr><td><input type="text" name="id"></td></tr>
        <tr>
            <td>image url:</td><td><input type="file" name="file"></td>
        </tr>   
        <tr>
            <td>user name:</td><td><input type="text" name="username"></td>
        </tr>
        <tr>
            <td>file name:</td><td><input type="text" name="filename"></td>
        </tr>
           
        <tr>
            <td align="center" colspan="2"><input type="submit" name="upload" value="Upload"></td>
        </tr>
    </table>
</form>
</body>   
</html>

No comments:

Post a Comment

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...