Uploader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Uploader

    heres a handy upload script that i use was based off the TTuplaoder i think that what it was called lol

    Code:
    echo "[u][i][b]Upload[/b][/i][/u]
    ";    
    echo "<p align=\"center\">
    Image Files
    \n";
    $size_bytes=2048000;
    $kb=$size_bytes/1024;
    $mb=$kb/1024;
    echo "Max [b]$mb[/b] Mb
    
    <img src=\"../images/point.gif\" alt=\"!\"/>You can email ur pic to
    
    [b]afta_drk@hotmail.com[/b]
    
    wif ur username attached or use the below uploader
    </p>
    <div class=\"center\">
    <form method=\"post\" enctype=\"multipart/form-data\" action=\"./upload.php?upload=yes&amp;sid=$sid\">
    <input type=\"file\" name=\"filetoupload\"/>
    
    <input type=\"submit\" name=\"uploadform\" value=\"Upload\"/>
    </form>
    </div>
    <p align=\"center\">\n";
    $extlimit="yes";
    $limitedext=array(".jpg",".jpeg",".gif",".png");
    $ext=strtolower(strrchr($_FILES[&#39;filetoupload&#39;][name],&#39;.&#39;));
    $file_type=$_FILES[&#39;filetoupload&#39;][&#39;type&#39;];
    $file_name=$_FILES[&#39;filetoupload&#39;][&#39;name&#39;];
    $file_size=$_FILES[&#39;filetoupload&#39;][&#39;size&#39;];
    $file_tmp=$_FILES[&#39;filetoupload&#39;][&#39;tmp_name&#39;];
    if($upload=="yes"){
    if(!is_uploaded_file($_FILES[&#39;filetoupload&#39;][&#39;tmp_name&#39;])){
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>No file selected!
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else if($extlimit=="yes" && !in_array($ext,$limitedext)){
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>Invalid file type!
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else if($file_size>$size_bytes){
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>Exceeded File size limit! Maximum [b]$kb[/b] Kb.
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else if(file_exists("./$file_name")){
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>Filename already exists!
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else if(file_exists("./".getnick_sid($sid)."(5)".$ext)){
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>
    [b]Error!!![/b]
    5 pics hav already been uploaded...
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else if($file_size){
    if(!file_exists("./".getnick_sid($sid)."(1)".$ext)){$pic=getnick_sid($sid)."(1)".$ext;}
    if(file_exists("./$pic")){$pic=getnick_sid($sid)."(2)".$ext;}
    if(file_exists("./$pic")){$pic=getnick_sid($sid)."(3)".$ext;}
    if(file_exists("./$pic")){$pic=getnick_sid($sid)."(4)".$ext;}
    if(file_exists("./$pic")){$pic=getnick_sid($sid)."(5)".$ext;}
    move_uploaded_file($file_tmp, "./$pic");
    echo "
    <img src=\"../phpThumb/phpThumb.php?src=../gallery/$pic&amp;w=150\" alt=\"$pic\"/>
    
    <img src=\"../images/ok.gif\" alt=\":o)\"/>
    
    $file_name
    
    sucessfully uploaded!
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    else{
    echo "<img src=\"../images/error.gif\" alt=\"[x]\"/>Unknown error! Pls try again...
    
    
    
    <a href=\"./gallery.php?sid=$sid\">Gallery Pics</a>\n";
    }
    }
    echo "</p>
    <p align=\"center\">
    <a href=\"../inbox/inbox.php?sid=$sid\">Inbox</a>
    
    <a href=\"../buds/buds.php?sid=$sid\">BuddyList</a>
    
    <a href=\"../chat/public.php?sid=$sid\">Chat</a>
    
    <a href=\"../forums/forums.php?sid=$sid\">Forums</a>
    
    <a href=\"../main.php?sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>
    </p>";

    #2
    that 1 was used 4 a gallery so u can add other file types or setting
    $extlimit="yes"; to $extlimit="no";
    will mean any file type can be uploaded

    Comment


      #3
      if u need phpthumb i can upload it or u can find it at http://phpthumb.sourceforge.net i think

      Comment


        #4
        i used phpthumb to cut down the pics 4 mobiles wifout having to edit the pics at all

        Comment

        Working...
        X