Php Picture Upload Script

Discussion in 'Forum Feedback, Development and Competitions' started by smsabbir480, Jul 11, 2014.

  1. smsabbir480

    smsabbir480 New Member

    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <title>Untitled Document</title>

    <form action=”<?php echo $_SERVER['PHP_SELF'];?>” method=”post” enctype=”multipart/form-data”>
    <h1>Upload image</h1>
    <P>Select an image: </P><input type=”file” name=”s” /><input type=”submit” value=”Upload” />
    print”Filename : $filename<br/>
    Filepath : $filepath<br/>
    Size : $filesize KB<br/>
    Type : $filetype<br/>”;
    if($filetype=”image/jpeg” or $filetype=”image/png” or $filetype=”image/gif”)
    echo”<img src=\”$upload/$filename\” height=\”500\” width=\”500\”/>”;
    echo”Couldn’t copy.”;

    echo”<br/>Picture uploaded.<br/>and search it by<br/>”;
    echo “localhost/teach/$upload/$filename”;
    echo”No activity.”;


    1)At first create a folder in the xampp/htdocs directory.Then inside the folder create another folder named ‘img’.It is the directory where the picture will be stored.

    2)Now copy the PHP script and paste it in the directory where the ‘img’ folder is located but don’t paste the PHP script inside the ‘img’ directory.

    3)In this script there is variable declared name ‘$filetype‘.If the picture format is JPEG,PNG or GIF then the picture will be uploaded otherwise the script won’t work.

Share This Page