Jump to content

help. want to download file via ftp.


redarrow

Recommended Posts

want to download a file via ftp but i want the file to come down on set blocks off code till it finish.

 

can you point me in the right direction off a tutorial, or a link thank you

 

example let say the file was 100mb want it to come down in blocks off 10mb

 

that a example only.

 

 

<?php

// define some variables
$local_file = 'local.zip';
$server_file = 'server.zip';

// 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_file, FTP_BINARY)) {
    echo "Successfully written to $local_file\n";
} else {
    echo "There was a problem\n";
}

// close the connection
ftp_close($conn_id);

?>

Link to comment
https://forums.phpfreaks.com/topic/148782-help-want-to-download-file-via-ftp/
Share on other sites

i want to control the bytes the file is downloading in bandwidth speed.

 

is there a ftp function that allow you to control the amount off bytes a file get downloaded please.

 

i see that there a function called ftp_size . it get the size off the bytes within the file, is there anyway to use that function or another to set the bytes coming down set to your preference.

this is a long shot maybe i can control the

download size via  a .httaccess just for that ftp script only.

 

any i dears.

 

example set these in the .httaccess file.

 

file_uploads

upload_max_filesize

max_input_time

memory_limit

max_execution_time

post_max_size

 

will post max size post, the set of bytes and send only them bytes, until the ftp download is finished.

 

there must be someone out there that has made a code with ftp that only allows the set bytes to be download to there preference via ftp.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.