Upload php file to another server

Asked

Viewed 1,456 times

-1

Upload heavy files to another server using PHP

Send Autocad files, and these files are heavy...I wanted to know if there is a way for the user to enter the site, in the sector to send these files, IE, will have a form where the user will send this file and will send to a server within the company.

  • 3

    You need to detail your question. What exactly is your question?

  • Can be sent via FTP

  • Then it would be interesting edit your question to make it clearer

  • 1

    Send Autocad files, and these files are heavy...I wanted to know if there is a way for the user to enter the site, in the sector to send these files, IE, will have a form where the user will send this file and will send to a server within the company.

  • Ah, you see, there are many more details! Porfa, [Edit]and the question and include the new information.

1 answer

1

You can use the ftp_put function if you want to upload these files via FTP.

<?php
$file = 'somefile.txt';
$remote_file = 'readme.txt';

// 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);

// upload a file
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
 echo "successfully uploaded $file\n";
} else {
 echo "There was a problem while uploading $file\n";
}

// close the connection
ftp_close($conn_id);
?>

Source: PHP manual available at http://php.net/manual/en/function.ftp-put.php

As are heavy files consider using ajax in your requests and function set_time_limit on the server side.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.