SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strange issue uploding large file via FTP

    Hi !

    I have a script that ends up creating a zip file having 500-600mb of size.

    I have a 2nd script that uploads that zip file to a server daily. But there is some thing wrong.

    The script runs very good and start uploading the file. I checked via a FTP client to the target ftp location and the file is really in upload process. Its size starts with say 1mb, and increases. After some time, it even reaches, 300mb or 400mb, but suddenly, the script stops with a FTP Failed message and the file on server disappears. below is my code. Please guide what I am doing wrong.

    PHP Code:
    <?php
    set_time_limit
    (20000);
    error_reporting(E_ALL);

    $zip_file_name "thzipfile.zip";  
    $media_folder "__media";

    $ftp_server "ftp.remote_location.com";
    $conn_id ftp_connect($ftp_server);
    ftp_pasv($conn_idtrue);
    // login with username and password
    $ftp_user_name "my_user_name";
    $ftp_user_pass "my_password";

    $web_dir '/live/upload/' 
    $local_file_name $zip_file_name
    $web_location=$web_dir.$local_file_name;

    //build a fully qualified (FTP) path name where the file will reside
    $destination_file=$ftp_dir.$local_file_name;

    $login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);

    // check connection
    if ((!$conn_id) || (!$login_result)) {
    echo 
    "FTP connection has failed!";
    echo 
    "Attempted to connect to $ftp_server for user $ftp_user_name";
    exit;
    } else {
    echo 
    "Connected to $ftp_server, for user $ftp_user_name";
    }

    // Delete if file already exists
         
    @ftp_delete($conn_id,$web_location);
    // upload the file
          
    $upload = @ftp_put($conn_id$destination_file$local_file_nameFTP_BINARY);


    if (!
    $upload)
    {
       echo 
    "FTP upload has failed!";
    }
    else 
    {
        echo 
    "Uploaded $zip_file_name to $ftp_server as $destination_file";
    }


    ftp_close($conn_id);

    if (
    file_exists($web_location))
    {
        echo 
    "file was uploaded as $web_location";
    }
    ?>

  2. #2
    SitePoint Member
    Join Date
    Feb 2012
    Location
    Switzerland
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a guess: a settings issue?
    timeout or any size limit..

    I would look in that direction too..

    regards
    Hensel


Bookmarks

Posting Permissions

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