Results 1 to 6 of 6

Thread: Upload file

  1. #1
    Join Date
    Feb 2004
    Location
    depan pc
    Posts
    99
    Rep Power
    0

    Upload file

    halo...

    meh sini pakarČ php...
    sy ade download upload script dan berjaya la upload file kat server... tp la yg buat sy musykil la kan... dier leh set limit saiz... so sy set ler...

    then... mmg jalan rr script tu...
    tp yg nak sy citekan kat sini sy set la limit saiz tu melebihi 2mb
    cth la 5mb...

    sy upload mp3 2mb kebawah semua lepas... tp bila dah lebih 2mb je dia error x leh upload... padahal saiz limit dia 5mb...

    kenapa yer? mmg server set ke?

    scriptnyer seperti berikut...

    PHP Code:
    # header & title of this file
    $title "File Upload Manager";

    # individual file size limit - in bytes (102400 bytes = 100KB)
    $file_size_ind "102400";

    # the upload store directory (chmod 777)
    $dir_store"store";

    # the images directory
    $dir_img"img";

    # the style-sheet file to use (located in the "img" directory, excluding .css)
    $style "style-def";

    # the file type extensions allowed to be uploaded
    $file_ext_allow = array("gif","jpg","jpeg","png","txt","nfo","doc","rtf","htm","dmg","zip","rar","gz","exe");

    # option to display the file list
    # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
    $file_list_allow 1;

    # option to allow file deletion
    # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
    $file_del_allow 1;

    # option to password-protect this script [-part1]
    # to enable/disable, enter '1' to ENABLE or '0' to DISABLE (without quotes)
    $auth_ReqPass 0;

    # option to password-protect this script [-part2]
    # if "$auth_ReqPass" is enabled you must set the username and password
    $auth_usern "username";
    $auth_passw "password";

    ################ end of configurations ###############


    # DO NOT ALTER OR EDIT BELOW THIS LINE UNLESS YOU ARE AN ADVANCED PHP PROGRAMMER

    ?> 
    besambung

  2. #2
    Join Date
    Feb 2004
    Location
    depan pc
    Posts
    99
    Rep Power
    0
    PHP Code:
    if (@phpversion() < '4.1.0') {
        $_FILE = $HTTP_POST_FILES;
        $_GET = $HTTP_GET_VARS;
        $_POST = $HTTP_POST_VARS;
    }
    clearstatcache();
    error_reporting(E_ALL & ~E_NOTICE);
    $fum_vers = "1.3"; # do not edit this line, the script will not work!!!
    $fum_info_full = "File Upload Manager v$fum_vers";

    function authDo($auth_userToCheck, $auth_passToCheck) 
    {
        global $auth_usern, $auth_passw;
        $auth_encodedPass = md5($auth_passw);
        
        if ($auth_userToCheck == $auth_usern && $auth_passToCheck == $auth_encodedPass) {
        $auth_check = TRUE;
        } else {
        $auth_check = FALSE;
        } 
        return $auth_check;
        }
        
        if (isset($logout)) {
        setcookie ('fum_user', "",time()-3600); 
        setcookie ('fum_pass', "",time()-3600);
        }
            
        if (isset($login)) {
        $auth_password_en = md5($auth_formPass); 
        $auth_username_en = $auth_formUser;

        if (authDo($auth_username_en, $auth_password_en)) { 
        setcookie ('fum_user', $auth_username_en,time()+3600); 
        setcookie ('fum_pass', $auth_password_en,time()+3600); 
        $auth_msg = "<b>Authentication successful!</b> The cookies have been set.<br><br>".
        $auth_msg . "Your password (MD5 encrypted) is: $auth_password_en";
        } else { 
        $auth_msg = "<b>Authentication error!</b>";
        }
    }

    if (($_GET[act]=="dl")&&$_GET[file]) 
    {
        if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && isset($fum_user) && !isset($logout))) { 
        if ($auth_ReqPass != 1 || ($auth_ReqPass == 1 && authDo($fum_user, $fum_pass))) {

        $value_de=base64_decode($_GET[file]);
        $dl_full=$dir_store."/".$value_de;
        $dl_name=$value_de;

        if (!file_exists($dl_full))
        { 
        echo"ERROR: Cannot download file, it does not exist.<br>»<a href=\"$_SERVER[PHP_SELF]\">back</a>";  
        exit();
        } 
        
        header("Content-Type: application/octet-stream");
        header("Content-Disposition: attachment; filename=$dl_name");
        header("Content-Length: ".filesize($dl_full));
        header("Accept-Ranges: bytes");
        header("Pragma: no-cache");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
        header("Content-transfer-encoding: binary");
                
        @readfile($dl_full);
        
        exit();

        }
        }
    }

    function getlast($toget)
    {
        $pos=strrpos($toget,".");
        $lastext=substr($toget,$pos+1);

        return $lastext;
    }

    function replace($o)
    {
        $o=str_replace("/","",$o);
        $o=str_replace("\\","",$o);
        $o=str_replace(":","",$o);
        $o=str_replace("*","",$o);
        $o=str_replace("?","",$o);
        $o=str_replace("<","",$o);
        $o=str_replace(">","",$o);
        $o=str_replace("\"","",$o);
        $o=str_replace("|","",$o);
        
        return $o;
    }

    ?>
    <!-- <?=$fum_info_full?> -->

  3. #3
    Join Date
    Feb 2004
    Location
    depan pc
    Posts
    99
    Rep Power
    0
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title><? echo ($title) ? ($title) : ("File Upload Manager"); ?></title>
    <link rel="stylesheet" href="<?=$dir_img?>/<?=$style?>.css" type="text/css">
    <?
        
    if ($auth_ReqPass == 1
        { 
            if (isset(
    $login) || isset($logout)) {
                echo(
    "<meta http-equiv='refresh' content='2;url=$_SERVER[PHP_SELF]'>");
            }
        }
    ?>
    </head>
    <body bgcolor="#F7F7F7"><br><br>
    <center>
    <?    
        
    if ($auth_ReqPass != || ($auth_ReqPass == && isset($fum_user) && !isset($logout))) { 
        if (
    $auth_ReqPass != || ($auth_ReqPass == && authDo($fum_user$fum_pass))) {
    ?>
    <table width="560" cellspacing="0" cellpadding="0" border="0">
      <tr>
        <td><font size="3"><b><i><? echo ($title) ? ($title) : ("File Upload Manager"); ?></i></b></font>&nbsp;<font style="text-decoration: bold; font-size: 9px;">v<?=$fum_vers?></font>&nbsp;
    <? 
        
    #--Please do not remove my link/copyright as it is unfair and a breach of the license--#
        
    echo"<a href=\"http://www.mtnpeak.net\" style=\"text-decoration: none; color: #C0C0C0; font-size: 9px; cursor: default\";>&copy; thepeak</a>"
    ?>
        </td>
       </tr>
    </table>
    <?
        
    if (!eregi("777",decoct(fileperms($dir_store))))
        {
            echo
    "<br><br><b><h4><font color=\"FF0000\">ERROR: cannot access the upload store file directory. please chmod the \"$dir_store\" directory with value 0777 (xrw-xrw-xrw)!</h4></font></b><br>»<a href=\"$_SERVER[PHP_SELF]\">refresh</a>";
        }
        else
        {
            if (!
    $_FILES[fileupload])
            {
    ?>
    <table width="560" cellspacing="0" cellpadding="0" border="0" class="table_decoration" style="padding-top:5px;padding-left=5px;padding-bottom:5px;padding-right:5px">
      <form method="post" enctype="multipart/form-data">
      <tr>
        <td>file:</td><td><input type="file" name="fileupload" class="textfield" size="30"></td>
      </tr>
      <tr>
        <td>rename to:</td><td><input type="text" name="rename" class="textfield" size="46"></td>
      </tr>
      <tr>
        <td>file types allowed:</td><td>
        <?
        
    for($i=0;$i<count($file_ext_allow);$i++)
        {
            if ((
    $i<>count($file_ext_allow)-1))$commas=", ";else $commas="";
            list(
    $key,$value)=each($file_ext_allow);
            echo 
    $value.$commas;
        }
        
    ?>
        </td>
      </tr>
      <tr>
        <td>file size limit:</td>
        <td>
            <b><?
                
    if ($file_size_ind >= 1048576
                {
                    
    $file_size_ind_rnd round(($file_size_ind/1024000),3) . " MB";
                } 
                elseif (
    $file_size_ind >= 1024
                {    
                    
    $file_size_ind_rnd round(($file_size_ind/1024),2) . " KB";
                } 
                elseif (
    $file_size_ind >= 0
                {
                    
    $file_size_ind_rnd $file_size_ind " bytes";
                } 
                else 
                {
                    
    $file_size_ind_rnd "0 bytes";
                }
                
                echo 
    "$file_size_ind_rnd";
            
    ?></b>
        </td>
      </tr>
      <tr>
        <td colspan="2"><input type="submit" value="upload" class="button">&nbsp;<input type="reset" value="clear" class="button"></td>
      </tr>
      </form>
    </table>

  4. #4
    Join Date
    Feb 2004
    Location
    depan pc
    Posts
    99
    Rep Power
    0
    xpe rr padam je mesej neh...

  5. #5
    Join Date
    Aug 2003
    Location
    sabah
    Posts
    23
    Rep Power
    0

    i know this script!!

    saya dah try script ni..boleh run smooth takdak masalah tukar je

    # individual file size limit - in bytes (102400 bytes = 100KB)
    $file_size_ind = "102400";

    jadik

    # individual file size limit - in bytes (102400 bytes = 100KB)
    $file_size_ind = "102400000"; --- 10 meg

    ok jer..

  6. #6
    Join Date
    Jan 2005
    Location
    Malaysia
    Posts
    54
    Rep Power
    180
    Dah check ko punyer php upload_max_filesize ker? Biasanya default 2M jer. Cuba refer dengan hosting provider ko.
    Last edited by Mesra; 26-04-2005 at 01:43 AM.
    Traveler

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Rapidmirrors.com File Upload/Mirroring
    By rekomaster in forum Websites Review and Suggestion
    Replies: 3
    Last Post: 10-11-2009, 10:06 AM
  2. upload file
    By aaxeem in forum Website Programming
    Replies: 2
    Last Post: 13-08-2005, 01:53 AM
  3. upload file
    By nurulmajdi in forum Website Programming
    Replies: 21
    Last Post: 15-04-2004, 02:01 PM
  4. Camner Nak Upload file .php
    By akmis in forum Website Programming
    Replies: 21
    Last Post: 12-05-2003, 04:06 PM
  5. upload file via web browser
    By mbek in forum Website Programming
    Replies: 2
    Last Post: 06-04-2003, 11:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31