+ Reply to Thread
Results 1 to 2 of 2

Thread: Simple Image Upload [PHP]

  1. #1
    ak007's Avatar
    ak007 is offline x10 Sophmore ak007 is an unknown quantity at this point
    Join Date
    Jun 2005
    Location
    127.0.0.1
    Posts
    108

    Thumbs up Simple Image Upload [PHP]

    Ive Made This Simple Image Upload Script For Use In Uploading Images Like Screenshots Sigs or Avatars Currently in Beta (Made In 10 min ;) )

    Some Features :
    Easy To Setup
    Filesize Limit
    Format Limit (Only Images)
    Random File Name Genration According To User Input And Type
    Eaisly Integrate With Your Site
    Hope You Enjoy It Comments Are Welcomed

    PHP Code:
    <?php
    if(!empty($_POST)){
    ########   Basic Settings    ########
    // Your Root Directory 
    $base "/home/username/public_html/";
    //The Directory Where Files Will Be Uploaded
    $dir "/uploads/";
    // Your Site URL
    $url "http://****x10hosting.com";
    ####################################
    $allowded = array("image/bmp","image/pjpeg" "image/jpeg" "image/gif" "image/png" "image/jpg");
    $name $_POST[name];
    $type $_POST[type];
    $rand rand100 20000);
    //echo $_FILES[file][type];
    //echo $_FILES[file][tmp_name];
            
    if(empty($_POST[name]) || empty($_POST[type])){
            echo 
    "You Forgot To Fill the required Feild Please Fix The Error";
                                            }
            elseif(!
    in_array($_FILES[file][type] , $allowded)){
            echo 
    "Un Expected File Format Only Images Supported";
                                                }
                     elseif(
    $_FILES[file][size] >= 500000){
                     echo 
    "Too Large File!!! Maximum File Size Allowded IS 500 kb!!";
                        }
                                                
                    else{
                 
    $filename $name."_"."$type"."_".$rand."_".$_FILES[file][name];
                    
    $file $base.$dir.$filename;
                    
    //echo $file;
                 
    $upload move_uploaded_file($_FILES[file][tmp_name] , $file);
                    
    chmod($file 0755);
                    
    //echo $_FILES[file][size];
                    
    if($upload){
                 echo 
    "File Uploaded Sucessfully !!! <br><a href=\"".$url.$dir.$filename"\">Click Here To view your File</a> &nbsp; <br>";
                 echo 
    "Your Code To Post That Image In Forum Is <b> : [IMG]".$url.$dir.$filename."[/IMG]</b><br>";
                 echo 
    "Just Copy the Above Code And paste It Where You Wana See this Image In the forum";
                    exit;
                    
                    
                            }
                    }
        }
    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <style type="text/css">
    <!--
    body,td,th {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        color: #00FF33;
    }
    body {
        background-color: #000000;
    }
    .style1 {
        font-size: 18px;
        font-weight: bold;
    }
    a:link {
        color: #FFFFFF;
        text-decoration: none;
    }
    a:visited {
        text-decoration: none;
        color: #FFFFFF;
    }
    a:hover {
        text-decoration: underline;
        color: #FFFFFF;
    }
    a:active {
        text-decoration: none;
        color: #FFFFFF;
    }
    -->
    </style></head>

    <body>
    <div align="center">
      <form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
        <table width="431" border="0" align="center">
          <tr>
            <td colspan="2"><div align="center"><span class="style1">~~~Upload~~~</span></div></td>
          </tr>
          <tr>
            <td width="131">Your Name </td>
            <td width="290"><input name="name" type="text" id="name" /></td>
          </tr>
          <tr>
            <td><div align="left">Picture Type <br />
            </div></td>
            <td><select name="type" id="type">
              <option>Sig</option>
              <option>Wallpaper</option>
              <option>Screenshot</option>
            </select>
            </td>
          </tr>

          <tr>
            <td><label>Select Your File : </label></td>
            <td><input type="file" name="file" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="Submit" /></td>
          </tr>
        </table>
      </form>
    </div>
    </body>
    </html>
    Upcoming Features:
    User Management
    Full Installation Setup
    Anti-Spam System
    Upload Limit Per User
    Ip Banning
    And More......
    Last edited by ak007; 10-10-2005 at 09:03 AM.





  2. #2
    minievan Guest

    Re: Simple Image Upload [PHP]

    Very Nice 8/10

+ Reply to Thread

Similar Threads

  1. [PHP] How to create a simple contact form
    By nightscream in forum Tutorials
    Replies: 6
    Last Post: 01-23-2011, 11:37 AM
  2. errors while attaching
    By mattspec in forum Feedback and Suggestions
    Replies: 0
    Last Post: 12-19-2005, 01:50 PM
  3. November Desktop
    By n4tec in forum Off Topic
    Replies: 12
    Last Post: 11-08-2005, 07:18 AM
  4. [PHP] Creating a File Upload Script
    By o0slowpaul0o in forum Tutorials
    Replies: 17
    Last Post: 10-05-2005, 01:39 AM
  5. [PS] Simple Signature
    By doomachine2000 in forum Tutorials
    Replies: 3
    Last Post: 05-05-2005, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers