我已经找到了很多关于此的答案,这里是我用过的,也许你可以找到什么错误的
$target_file = $_FILES["photo"]["name"];
$remote_file = "/mj/web/uploads/images/" . $target_file;
$conn_id = ftp_connect("ftp.myftp.com") or die("Error in FTP connection");
$login_status = ftp_login($conn_id, "user", "pwd") or die("Error in FTP login");
$upload_status = ftp_put($conn_id, $remote_file, $target_file, FTP_BINARY);
if (!$upload_status){
echo "file not uploaded ";
}
ftp_close($conn_id);
我认为问题出在这里的路径是它打印的错误但是我找不到正确的方法,我尝试了很多东西
Warning: ftp_put(11896002_949007031828196_4852185396683089816_n.jpg): failed to open stream: No such file or directory in /homepages/44/d426574394/htdocs/maisonstunisie/insertmj/config.php on line 72
档案未上传
以下是按要求添加的HTML表单:
<tr>
<td>
Titre Annonce :
</td>
<td>
<input type="text" ID="titre_annonce" name="titre_annonce" />
</td>
</tr>
<tr>
<td>
Description annonce :
</td>
<td>
<input type="text" ID="desc" name="desc" />
</td>
</tr>
<tr>
<td> Photo :</td>
<td><input type="file" name="photo" id="photo"></td>
</tr>