O
O
okuznetsov12016-12-21 14:58:05
PHP
okuznetsov1, 2016-12-21 14:58:05

How to create an empty FTP file using php-curl?

Is it possible to do this with curl? I ask because after analyzing the list of service ftp commands, I did not find the command to create a file (there are commands: create a directory (MKD), delete a directory (RMD) and a file (DELE))
I wanted to do it this way:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'ftp://' . $ftphost);
curl_setopt($ch, CURLOPT_USERPWD, $ftpuser.':'.$ftppassword);
curl_setopt($ch, CURLOPT_QUOTE, array('Команда создания файла ' . $dir . $name_file , 'QUIT'));
 curl_exec($ch);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2016-12-21
@okuznetsov1

FTP does not have a command to create a file. You will have to send the file using curl.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question