Uploader size

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

    Uploader size

    i have a small error everytime i try to upload a file bigger than 1mb it say so no input space
    Code:
    <?
        session_name("PHPSESSID");
    session_start();
    function get_files($dirstr)
      {
       $scanfiles = array();
       $fh = opendir($dirstr);
       while (false !== ($filename = readdir($fh)))
       {
    if (is_file("$dirstr/$filename")) {
         array_push($scanfiles, $filename); }
       }
       closedir($fh);
       sort($scanfiles);
       return $scanfiles;
    }
    
    
    $count = count($_FILES['userfile']['name']);
    if ($count > 0) {
    
    $i=0;
    $f=0;
    while ($i < $count) {
    
    $kbsize = (round($_FILES['userfile']['size'][$i]/5000));
    $date = date("j M Y g:ia", time()+($timeoffset*3600));
    $userip = $_SERVER['REMOTE_ADDR'];
    
    if ($limitsize == 1) {
    if ($_FILES['userfile']['size'][$i] > (1024*$maxsize) ) {
    $toobig[$i] = "{$_FILES['userfile']['name'][$i]} is too large! the maximum file size is $maxsize kb.";
    } }
    
    if ($acceptfilter == 1) {
    if (!in_array($_FILES['userfile']['type'][$i], $acceptabletypes)) {
    $rejectstring = "{$_FILES['userfile']['name'][$i]} is not of the type ";
    foreach ($acceptabletypes as $acceptabletype) {
    $rejectstring .= "$acceptabletype or "; }
    $rejectstring = substr($rejectstring, 0, -4);
    $notacceptable[$i] = "$rejectstring.";
    } }
    
    if ($overwriting !== 1) {
    if(file_exists("pkfiles/{$_FILES['userfile']['name'][$i]}")) {
    $alreadyexists[$i] = "a file of the name {$_FILES['userfile']['name'][$i]} already exists! overwriting is not permitted.";
    } }
    
    if (!isset($toobig[$i]) && !isset($notacceptable[$i]) && !isset($alreadyexists[$i])) {
    $file="{$_FILES['userfile']['name'][$i]}";
    $videsc = $_POST["videsc"];
    if(spacesin($file))
    {
            echo "No input space!.<br/>";
     }else{
    if (!eregi("\.(mid|gif|bmp|mid|midi|3gp|mp3|mp4|wav|mpn|nth|mpc|jar|jad|jpeg|jpg|sis|mmf|amr|thm|png|wbmp|rar|zip)$",$file))
    {
     echo "Unsupported file extension!<br/>";
     }else{
    
    copy($_FILES['userfile']['tmp_name'][$i], "pkfiles/{$_FILES['userfile']['name'][$i]}");
    echo "{$_FILES['userfile']['name'][$i]}<br>";
    $ext = getext($file);
            $mime = getextfile($ext);
    $file = "{$_FILES['userfile']['name'][$i]}";
    $filesize = filesize("./pkfiles/".$file);
    $filesize = $filesize / 50000;
    $fsize = 0;
    $fsizetxt = "";
      if ($filesize < 1)
      {
         $fsize = round($filesize*50000);
         $fsizetxt = "".$fsize." KB";
        $check1 = "KB";
      }else{
         $fsize = round($filesize,2);
         $fsizetxt = "".$fsize." MB";
    $check1 = "MB";
      }
     $info = "<br/>Name<br/>".$file." Type<br/>".$mime." Size<br/>".$fsizetxt."";
    $res = mysql_query("INSERT INTO ibwf_vault SET uid='".$uid."', title='".$file."', pudt='".time()."', did='".$did."', info='".$info."', filesize='".$fsizetxt."', mime='".$mime."', itemurl='".$file."'");
          if($res)
          {
            echo "File successfully uploaded!<br/>";
          }else{
            echo "Invalid or already in our database!<br/>";
          }
    }
    
    
    }
    $f++;
    $content .= "$date $userip uploads pkfiles/{$_FILES['userfile']['name'][$i]} ($kbsize kb)\n";
    }
    
    elseif ($_FILES['userfile']['size'][$i] !== 0) { 
    echo "$toobig[$i] $notacceptable[$i] $alreadyexists[$i]<br>"; 
    $content .= "$date $userip fails to upload $uploaddir/{$_FILES['userfile']['name'][$i]} ($kbsize kb) - $toobig[$i] $notacceptable[$i] $alreadyexists[$i]\n";
    }
    
    $i++;   
    }
    
    
    
    if ($makelog == 1) {
    $handle = fopen("$logfile", "a");
    fwrite ($handle, $content);
    fclose ($handle); }
    
    }
    
    
    ?>
    
    
    <form action="<?= $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; ?>" method="post" enctype="multipart/form-data">
      Add files and Get 5 Plusses for Every Downloads :)
    <br>
    
    <?
    for($d=0; $d < $fields; $d++) {
    
    echo "<input name=\"userfile[]\" type=\"file\" size=\"30\"><br>"; 
    
    }
    ?>
      Category:<br/><select name="did">
      <option value="1">Symbian Software</option>
     <option value="2">Java Software</option>
     <option value="3">Anti Virus</option>
    <option value="4">s40v2/s40v3 Themes</option>";
      <option value="5">s60/s60v3/Nseries Themes </option>
     <option value="6">Sony Ericsson Themes </option>
      <option value="7">s30/40/s40v2 Games </option>";
      <option value="8">s60/s60v3 Games </option>";
      <option value="9">Eseries/Nseries/Ngage Games </option>
     <option value="10">Sony Ericsson Games</option>
     <option value="11">Full MP3</option>
      <option value="12">3GP Videos</option>
     <option value="13">Scandal</option>
    <option value="14">Gameboy Games</option>
     <option value="15">Naruto Themes/Poly/MP3</option>
     <option value="16">MP3/MIDI/WAV/POLY/AMR/RAR</option>
         <option value="17">Opera Software</option>
     <option value="18">Jpeg Gif Png</option>
      </select><br/>
    
    <input type="submit" value="Upload now">
    </form>
    
    
    <?
    
    echo "<ul>";
    
    
    if ($limitsize == 1) {
    echo "<li><b>The Maximum File size is 5MB.</b></li>"; }
    
    
    echo "</ul>";
    if ($ver==wml)
    {
    echo "<a href=\"index.php?action=vault\">Downloads</a><br/>";
    echo "<a href=\"index.php?action=main\">Main menu</a><br/>";
    }else{ 
    echo "<a href=\"index.php?action=vault\">Downloads</a><br/>";
    echo "<a href=\"index.php?action=main\">Main menu</a>";
    }
    unset($count, $acceptabletypes, $handle, $content, $date, $kbsize);
    
    
    ?>

    #2
    edit didnt read ur post
    have u tried allowing a higher upload limit thru .htaccess
    Last edited by Loony; 22.09.09, 21:28.
    Creator of
    Epix.Mobi

    Keep an Eye on us Big things coming soon!!!!
    Need something for your site hit me up here

    http://coding-talk.com/forum/main-fo...r-your-wapsite

    Comment


      #3
      here try these ur htaccess file
      Code:
      php_value upload_max_filesize 20M
      php_value post_max_size 20M
      php_value max_execution_time 200
      php_value max_input_time 200
      Creator of
      Epix.Mobi

      Keep an Eye on us Big things coming soon!!!!
      Need something for your site hit me up here

      http://coding-talk.com/forum/main-fo...r-your-wapsite

      Comment


        #4
        Originally posted by loony View Post
        here try these ur htaccess file
        Code:
        php_value upload_max_filesize 20M
        php_value post_max_size 20M
        php_value max_execution_time 200
        php_value max_input_time 200
        is it host/server dependent? i mean, can any host handle 20M or bigger filesize?

        just wondering...
        LDSWAPWORLD sigpic
        site closed.
        im busy with other things in life like facebook , send me PM so i can add you
        www.pinoySG.com

        don't ask for help if you're not even helping yourself!
        i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.


        Comment


          #5
          mine can upload any limit of size only if there are enought disk space left i use to upload stuff that are 30mb lol

          Comment


            #6
            Where is the function defination for spacesin() ??

            Comment


              #7
              rider use the code which loony has told to in ur .htacess all will work fine
              and
              capofret its not dependent on host
              E107 Security Team Leader
              Proudly Support AccountLab Plus Billing Software

              Want your Apps to be Developed ??? mail us your requirement at info@csarlab.com
              ------------------

              Comment


                #8
                Originally posted by riderz View Post
                mine can upload any limit of size only if there are enought disk space left i use to upload stuff that are 30mb lol

                so u can upload any file size with that uploader script? how about downloading that file? im not talking about thru ftp because we all know we can upload any file size thru that.

                i want to learn thats why im asking to clarify
                LDSWAPWORLD sigpic
                site closed.
                im busy with other things in life like facebook , send me PM so i can add you
                www.pinoySG.com

                don't ask for help if you're not even helping yourself!
                i am tired of seeing the line "best site", i want to see something NEW and UNIQUE. maybe if i find one, ill go back to my wap life again.


                Comment


                  #9
                  capofret thats where i have a prob i dnt get that file to upload more than 1mb ive uploaded the htaccess file that they gave but still it dnt upload bigger files

                  Comment


                    #10
                    Looks like the size of file is being checked in function spacesin() and the defination of the function is no where in the code you have given. Find where this function has been defined and edit it.
                    Hope this will work for you

                    Comment


                      #11
                      Code:
                      //////////////////////////////////////////////////MISC FUNCTIONS
                      function spacesin($word)
                      {
                        $pos = strpos($word," ");
                        if($pos === false)
                        {
                          return false;
                        }else
                        {
                          return true;
                        }
                      }
                      this one is in core

                      Comment


                        #12
                        Nope, this just checks for spaces in name.

                        Comment


                          #13
                          This script wont allow you to upload files which have a space in there name. Just remove the spaces and your problem will be solved.
                          Hope this will help

                          Comment


                            #14
                            yea gotten the prob it had spaces in when ive uploaded it

                            Comment


                              #15
                              hmmm, i can not find the htd acesss to put higher for iles

                              Comment

                              Working...
                              X