dreamer2014520 2018-12-03 16:16 采纳率: 0%
浏览 47

PHP - 使用SFTP上传到远程存款

Is there a way to upload files from a FILE INPUT directly to another FTP without using stream_copy_to_stream() ? Actually, I have to do this without uploading the file on local host.

Here is my example code :

/*
    Consider I am getting uploaded files using AJAX
    but thoses files can be reached using $_FILES['file'].
*/

$ssh2 = ssh2_connect("xxxxxx");

if(ssh2_auth_password($ssh2, 'root', 'xxxxx')) {
    $ftp = ssh2_sftp($ssh2);

    $f = fopen("ssh2.sftp://".intval($ftp)."/ftp/images/img.png", 'w');

    /*
        I wonder if it's possible to write directly the content of the
        file inside $f ? Actually, I am uploading PICTURES. Any Idea ?
    */
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序