Upload Error..

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

    Upload Error..

    Hi Guy's im facing this problem in upload.php...you see when im clicking on upload,it's bringing me back to the same page again..nothing is even being uploaded to the tables aswell...here's the code...

    <?php
    include("../core.php");
    include("../config.php");
    connectdb();
    $uip = getip();
    $action = ($_GET["action"]);
    $sid = ($_GET["sid"]);
    $uid = getuid_sid($sid);
    $sid = ($_GET["sid"]);
    $site = ($_GET["site"]);
    $theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename = $sitename[0];
    if($action != "")
    {
    if(!islogged($sid))
    {
    echo "<head>";
    echo "<title>Error!!!</title>";
    echo "<link rel=\"StyleSheet\" type=\"text/css\" href=\"style/$theme[0]\" />";
    echo "</head>";
    echo "<body>";
    echo "<p align=\"center\">";
    echo "You are not logged in<br/>";
    echo "Or Your session has been expired<br/><br/>";
    echo "<a href=\"index.php\">Login</a>";
    echo "</p>";
    echo "</body>";
    echo "</html>";
    exit();
    }
    }
    echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html"/>
    <meta http-equiv="Cache-Control" content="no-cache" forua="true"/>';
    echo "<title>$site_name Upload Files</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/$theme[0]\">";
    echo "</head>";
    echo "<body><small>";
    //include("../web/header.php");
    echo "<div align=\"left\">";
    echo "<b>Fileshare uploader</b></div>";
    echo "<div align=\"left\">";
    if ($upload="upload"&&$superdat_name){
    if (!eregi("\.(gif|mid|midi|3gp|mpeg|mpg|mp4|mp3|wav| jar|jad|jpeg|jpg|sis|sisx|amr|zip|rar|thm)$",$supe rdat_name)){
    print "<b>Unsupported File Extention!</b>";
    }else{
    $superdat_name = preg_replace(
    '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
    ,'',str_replace(array(' ','%20',"'"),array('_','_', ""),$superdat_name));
    if(strlen($superdat_name)>50){ print "<b>File Name Is Too Long!</b>";
    }else{
    if (empty($superdat)) {
    print "<b>No input file specified!!!</b>";
    }else{
    copy("$superdat", "files/$superdat_name") or
    die("Couldn't copy file.");
    $date= time();
    $type = $_POST["dir"];
    $text2 = $_POST["name2"];
    $fsize=round($superdat_size/1024,1);
    $text = "&&$superdat_name&&$fsize KB&&$date&&$REMOTE_ADDR&&";
    $fz = "$fsize KB";
    if("$text"!="$check[1]"){
    $mysql=mysql_query("INSERT INTO ibwf_uploads2 SET uid='".$uid."', filename='".$superdat_name."', filename2='".$text2."', dir='".$type."', descrip='".$name."', filesize='".$fsize." KB', date='".$date."', date2='".date("l")."', uip='".$REMOTE_ADDR."'");
    echo mysql_error();
    }
    echo "<b>$superdat_name</b> has successfully been uploaded to our uploader";
    }
    }
    }
    }
    ?>
    <?php
    $post = mysql_fetch_array(mysql_query("SELECT posts FROM ibwf_users WHERE id='".$uid."'"));
    if($post[0]<30)
    {
    echo "You Need <b>100 plusses</b> and <b>30 Post</b> to upload your files!<br/>";
    }
    else
    {
    echo "<FORM align=\"left\" ACTION=\"upload.php?sid=$sid&amp;site=$site\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">";
    echo "Category:<br/><select name=\"dir\" value=\"$dir[0]\">";
    if($dir[0]=="1"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"1\"$selected>Applications</option>";
    if($dir[0]=="2"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"2\"$selected>Games</option>";
    if($dir[0]=="3"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"3\"$selected>Ringtones / Musics</option>";
    if($dir[0]=="4"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"4\"$selected>Pictures</option>";
    if($dir[0]=="5"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"5\"$selected>Themes</option>";
    if($dir[0]=="6"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"6\"$selected>Videos</option>";
    if($dir[0]=="7"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"7\"$selected>Zip Archives</option>";
    if($dir[0]=="8"){$selected=" selected=\"selected\"";}else{$selected="";}
    echo "<option value=\"8\"$selected>other</option>";
    echo "</select><br/>";
    echo "Filename:<br/><input type=\"text\" name=\"name2\" size=\"20\" maxlength=\"200\"/><br/>";
    echo "Description:<br/><input type=\"text\" name=\"name\" size=\"20\" maxlength=\"200\"/><br/>";
    echo "File: <br/><input type=\"file\" name=\"superdat\" size=\"20\"/><br/>";
    echo "<input type=\"submit\" value=\"Upload!\"/></form>";
    echo "P/s:<i>Please select file category to upload or your files will be deleted!</i><br/>";
    echo "P/s:<i>Filename must be less then 50</i><br/>";
    echo "<br/><b><u>Attentions</u></b><br/>Only File<br/>
    .gif .mid .midi .3gp .mpg .mp4 .mp3 .wav .jar .jad .jpg .sis .sisx .amr .zip .thm<br/>are Allow<br/>";

    if($site=="wap"){
    echo "<br/><a href=\"../fshare.php?action=main&amp;sid=$sid\">Uploaded Files</a><br/>";
    }else{
    echo "<br/><a href=\"../fshare.php?action=main&amp;sid=$sid\">Uploaded Files</a><br/>";
    }
    }
    if($site=="wap"){
    echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"/images/home.gif\" alt=\"\"/>Home</a>";
    }else{
    echo "<a href=\"../index.php?action=main&amp;sid=$sid\"><img src=\"/images/home.gif\" alt=\"\"/>Home</a>";
    }
    echo "</div>";
    //include("../web/footer.php");
    ?>
    </body>
    </html>

    Sometimes im wondering if the $site = ($_GET["site"]); is causing this..how can i change it?...thanks

    #2
    check fopen_url is on or not and also try to give chmod 777 to that directory

    Comment


      #3
      Awesome thanks...i'll try doing this, this afternoon...i will state if it works or not...

      Comment


        #4
        I could be wrong but you are using copy() function,
        in this case you should copy from temporary file to your file where you want to store it. where do you value $superdat?

        Why dont just use move_uploaded_file() ?

        Guys, try to see what kind of code are you using? Its never enough to copy-paste someone's code!
        Last edited by Mysterio; 21.11.11, 12:15.
        mysterio.al - programming is a functional art

        Comment


          #5
          i might not be right but it looks like its some thing to do with this
          Code:
          upload.php?sid=$sid&amp;site=$site
          HELP THEM WHO HELPS YOU



          i only work on wapdesire v_2 coding only

          Comment

          Working...
          X