0

我有代码将文件从服务器上的客户端保存到客户端域以外的某个域。我已经添加了标题,但它似乎不起作用,我错过了什么或者不可能做到这一点?请高手帮忙。提前致谢。

<?php
    ob_start();
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Credentials: true ");
    header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
    header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
     ob_clean();
    if(!isset($_REQUEST['filename']))
       {
         exit('No file');
       }
       $upload_path = dirname('ftp://username:password@domain/project1/x'). '/';
       $filename = $_REQUEST['filename'];
       $fp = fopen($upload_path."/".$filename.".wav", "wb");
       fwrite($fp, file_get_contents('php://input'));
       fclose($fp);
       exit('done');

       ?>
4

0 回答 0