Does it work if you do it from a FTP client? Filezilla etc.?
Aug 27, 2019
4
Level 46
Could not able to put the file in FTP Server
I'm trying to put the xml file in FTP Server using php and laravel.
I could not able to upload the file in the Server.
Here it's my code in php
$fileName = 'test.xml';
$filePath = public_path($fileName);
$conn_id = ftp_connect(env('FTP_HOST'));
ftp_login($conn_id, env('FTP_USERNAME'), env('FTP_PASSWORD'));
ftp_put($conn_id, '/files/test/', $filePath, FTP_ASCII);
But it is showing error as
ERROR:
ftp_put(): Could not create file.
I have tried in Laravel also
$fileName = 'test.xml';
\Storage::disk('ftp')->put($fileName, fopen(public_path($fileName), 'r+'));
I have configured the driver in filesystems
'ftp' => [
'driver' => 'ftp',
'host' => '12.12.12.12',
'username' => `user`,
'password' => 'password',
],
Expected : Need to put the xml file in ftp server which is in project public path.
Please or to participate in this conversation.