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

使用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.

    评论

报告相同问题?

悬赏问题

  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗