dqw7121 2016-03-07 10:21
浏览 43

视频未在dev服务器上传到Wistia

I am trying to upload a video to Wistia. Video is uploading successfully in my local server. But when I moved to development server, the video is not uploading it is showing error like "Internal Sever Error ".

Error message I am receiving :

Array
(
    [0] => HTTP/1.1 100 Continue

HTTP/1.1 500 Internal Server Error
Server: nginx/1.4.6 (Ubuntu)
Date: Mon, 07 Mar 2016 10:07:57 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 30
Status: 500 Internal Server Error
Access-Control-Allow-Origin: *
Set-Cookie: __bakery_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiRTYxN2JjZjE2OGI0YzJmYTE3MDU5%0AZTU0MWNmNWZlNjVkNDQzNzhmOWYwOGNlMWE0YTliNTQyMDNhNDg2ZGY3YjYG%0AOwBG%0A--4d80faca0eafbbec57b24297ed762aa798486fde; path=/; HttpOnly
Set-Cookie: rack.session=BAh7BkkiD3Nlc3Npb25faWQGOgZFVEkiRTYxN2JjZjE2OGI0YzJmYTE3MDU5%0AZTU0MWNmNWZlNjVkNDQzNzhmOWYwOGNlMWE0YTliNTQyMDNhNDg2ZGY3YjYG%0AOwBG%0A; path=/; HttpOnly
X-Served-By: bakery-breadroute-roll,bakery-prime-changeling

Internal Server Error

)

My Code for video upload:

<?php
if ($_POST['submit']) {
   $filePath = $_FILES['fileUploaded']['tmp_name'];

        $data = array(
        'api_password'  => '0fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5',
        'file'          => '@'.realpath($filePath),
        'description'   => 'This is a test video',
        );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_URL, "https://upload.wistia.com" );
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);    
    $result = curl_exec($ch);
    curl_close($ch);

}
    ?>
<form name="upload-form" method="POST" enctype="multipart/form-data">
    <input type="file" name="fileUploaded">
    <input type="submit" name="submit" value="Upload">
</form>

Any one help me , to resolve this problem.

  • 写回答

1条回答 默认 最新

  • dsxd62219570 2016-03-25 11:26
    关注

    Yes, finally I resolved my error. By using cURL file object method.

    // Create a cURL handle
    $ch = curl_init('http://example.com/upload.php');
    
    // Create a CURLFile object
    $cfile = new CURLFile('cats.jpg','image/jpeg','test_name');
    
    // Assign POST data
    $data = array('test_file' => $cfile);
    curl_setopt($ch, CURLOPT_POST,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    
    // Execute the handle
    curl_exec($ch);
    

    http://php.net/manual/en/curlfile.construct.php

    评论

报告相同问题?

悬赏问题

  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失