my site located in server 1 and some file located in server 2. When i want to download file from server 2 to client by using ftp_get()
or curl()
, that function download file from server 2 to server 1 not to client.
Server 2 is a private ftp server. If that is not possible with ftp there is no solution other than ftp ?
what is the best solution to store file to server 2?
Asked
Active
Viewed 460 times
-1

adib16
- 1,649
- 2
- 20
- 35
-
You can redirect them to the FTP URL. – Barmar May 05 '15 at 05:11
-
Maybe this will help http://stackoverflow.com/questions/7263923/how-to-force-file-download-with-php – maalls May 05 '15 at 05:12
-
server 2 require username and password.so how i can include username and password? – adib16 May 05 '15 at 05:21
-
Why are you posting the same question twice? http://stackoverflow.com/questions/30034047/download-file-from-ftp-server-directory-to-browser-with-php/30045249#30045249 – Martin Prikryl May 05 '15 at 06:06
1 Answers
0
One easy way is to use Cross Domain enabled ajax to send file (post method) to another server and use below header on server 2 to accept post data from server 1.
header('Access-Control-Allow-Origin: http://server1.com');

Sam
- 1,424
- 13
- 28