1 回答

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊
我設(shè)法通過本文中的 php chunk upload 來完成此操作: https://artisansweb.net/how-to-implement-chunk-upload-in-php/
php中分塊上傳的源代碼:
$tmpfile = 存儲路徑(路徑);
$orig_file_size = filesize($tmpfile);
$chunk_size = 256; // chunk in bytes
$upload_start = 0;
$handle = fopen($tmpfile, "rb");
$fp = fopen('ftp://USERNAME:PASSWORD@HOST:21//TARGETDIR/FILENAME', 'w');
while($upload_start < $orig_file_size) {
$contents = fread($handle, $chunk_size);
fwrite($fp, $contents);
$upload_start += strlen($contents);
fseek($handle, $upload_start);
}
fclose($handle);
fclose($fp);
- 1 回答
- 0 關(guān)注
- 123 瀏覽
添加回答
舉報(bào)