Results 1 to 3 of 3

Thread: Upload 2 MB

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User emagi's Avatar
    Join Date: Feb:2007
    Location: bulgaria
    Posts: 202

    Upload 2 MB

    !
    :
    Code:
    <?php
    $ftp_server = "172.16.2.1";
    $ftp_user_name = "xxxx";
    $ftp_user_pass = "xxxx";
    if (!isset($destdir)) {
        $destdir = "/";
    }
    if ($op=="upload") {
        if ($_FILES['userfile']['size'] > 0) {
            $destination_file=$destdir.$_FILES['userfile']['name'];
            $source_file=$_FILES['userfile']['tmp_name']; 
            $conn_id = ftp_connect($ftp_server);
            if (!$conn_id) {
                echo "Cannot connect FTP server";
            }
            $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
            
            if (!$login_result) {
                echo "FTP connection has failed!<br/>";
                echo "Attempted to connect to ".$ftp_server." for user ".$ftp_user_name."<br/>";
                die(0); // i
            } else {
                echo "Connected to ".$ftp_server.", for user :".$ftp_user_name."<br/>";
                $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
                if (!$upload) { // i?iaa?yaaia aaee a iaoniaoai upload-a
                    echo "FTP upload has failed!<br/>";
                } else {
                    echo "Uploaded ".$source_file." to ".$ftp_server." as ".$destination_file."<br/>";
                }
                ftp_close($conn_id);
            }
            echo "<a href='?op='>back to form</a><br/>";
        }
    
    } else {
    ?>
    <table align="center">
    <form enctype="multipart/form-data" action="?op=upload" method="post">
        <tr>
            <td align="right">Upload file: </td>
            <td><input name="userfile" type="file" /></td>
        </tr>
        <tr>
            <td align="right">Destination dir: </td>
            <td><input name="destdir" type="text" size="35"/></td>
        </tr>
        <tr>
            <td align="right"> </td>
            <td><input type="submit" value="Send file"/></td>
        </tr>
    </form>
    </table>
    </pre>
    <?php
    }
    ?>
    , - 2 ,! , ! , upload FTP . upload ajax, ?
    !

  2. #2
    Registered User fly's Avatar
    Join Date: Jun:2005
    Location:
    Posts: 803
    http://www.radinks.com/upload/config.php .htaccess :
    Code:
    php_value upload_max_filesize 16M
    php_value post_max_size 20M

  3. #3
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    , HTTP , . , php.ini. , :
    upload_max_filesize = 2M
    post_max_size = 8M
    .
    hidden MAX_FILE_SIZE, :
    <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
    , value .
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

Posting Permissions

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

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |