drvpv7995 2019-07-06 11:24 采纳率: 100%
浏览 1177

使用orthanc库上传文件夹Dicom

I want upload file DICOM and index all dcm files with orthanc Library. I write this code:

php:
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
    $url="http://localhost:8042/instances";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
    curl_setopt($ch, CURLOPT_POST,1 );
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: 
text/plain'));
    foreach ($_FILES['files']['tmp_name'] as $i => $name) {
        curl_setopt($ch, 
CURLOPT_POSTFIELDS,file_get_contents($name));
        $result=curl_exec($ch);
        print_r($result);   
    }
}

html:
<form method="post" enctype="multipart/form-data" action="#">
    <input type="file" name="files[]" id="files" multiple="" directory="" 
     webkitdirectory="" mozdirectory="">
    <input class="button" type="submit" value="Upload" />
</form>

this code takes long time so mush.. what is problem ?? I want method to upload directory of dcm files and index its togother with API orthanc and using php, js..

thank you..

  • 写回答

1条回答 默认 最新

  • douhu5837 2019-07-06 11:46
    关注

    I think you have to fill your POST in the following style:

    $cFile = curl_file_create($file_name_with_full_path);
    $post = array('file_contents'=> $cFile);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    

    Something like this. So first use curl_file_create and then put them in the POST and then you can put that to the post fields.

    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题