SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question cant upload big files cause of timeout

    A CronJob process uploads some files that people send me via email, but.. some files are very big and PHP timeouts before the upload. I mean, files of 5m and higher.

    How can i give PHP a little more of time?

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The set_time_limit function is what you're looking for - though I'd suggest using FTP rather than http.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Addict Feudalism's Avatar
    Join Date
    Jun 2002
    Location
    Buenos Aires, Argentina
    Posts
    361
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    any way to use FTP in php? didn't know!

  4. #4
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This will help you

    PHP Code:
    <?php
            
    // define some variables
            
    $folder_path " ";   // Folder Path without file name
            
    $local_file " ";       // File Name
            
    $server_file "";   // Server path + File name ex: /home/user/www/1123.zip
            
            
    $local_file_size filesize($local_file);     // getting the file size to resume.
           
            //-- Connection Settings
            
    $ftp_server " "// Address of FTP server.
            
    $ftp_user_name " "// Username
            
    $ftp_user_pass " "// Password
            #$destination_file = "FILEPATH";
           
            // set up basic connection
            
    $conn_id ftp_connect($ftp_server);
           
            
    // login with username and password
            
    $login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);
           
            
    // try to download $server_file and save to $local_file
            
    if (ftp_get($conn_id$local_file$server_fileFTP_BINARY$local_file_size)) {
                echo 
    "Successfully written to $local_file\n";
            } else {
                echo 
    "There was a problem\n";
            }
           
            
    // close the connection
            
    ftp_close($conn_id);
    ?>
    Thanks
    -Xak


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
  •