2014-03-07 3 views
1

Cloudup에 업로드하고 싶습니다. API-Dokumentation는 말한다 :Cloudup API를 사용하여 AWS에 업로드

POST가/항목 -d '파일 이름 = tobi.jpg & 제목 = 토비 & stream_id를 = cc3pGD6avN7'

내가 PHP를 사용하고 코드처럼 보이는

:

<?php  
    $context = stream_context_create(array(
     'http' => array(
      'method' => "POST", 
      'header' => "Authorization: Basic " . base64_encode("$user:$passwd"), 
      'content' => "filename=aNewFilee.jpg&stream_id=$STREAM_ID" 
    ) 
    )); 


    // Create a File 
    $data = file_get_contents("https://api.cloudup.com/1/items", false, $context); 
?> 

완벽하게 작동하며 파일이 클라우드 공간에 생성됩니다. 그러나 파일은 "비어 있습니다". 설명서에는 파일을 AWS S3에 업로드해야한다고 나와 있습니다. 그래서 나는 createt 파일에서 respone을 (모든 S3-구성 문자열을 포함하는)과 같은 코드 준비 :

<form action="$responseUrl" method="post" enctype="multipart/form-data"> 
    <input type="hidden" name="key" value="$responseKey"> 
    <input type="hidden" name="AWSAccessKeyId" value="$responsAccessKey"> 
    <input type="hidden" name="acl" value="public-read"> 
    <input type="hidden" name="policy" value="$responsePolicy"> 
    <input type="hidden" name="signature" value="$responseSignature"> 

    File to upload to S3: 
    <input name="file" type="file"> 
    <br> 
    <input type="submit" value="Upload File to S3"> 
</form> 

을 그리고 여기에 문제가 : 작동하지 않는 ... 은 내가 어떻게 업로드 할 수 있습니다 파일? 고맙습니다!

P .: AWS SDK 또는 cURL을 사용하고 싶지 않습니다.

답변

1

이 질문을보십시오 - Upload a file using file_get_contents. 대답은 데이터와 함께 전송해야하는 누락 된 필수 설정 및 매개 변수로 제공됩니다.

+0

감사합니다. Cloudup-Server 또는 AWS S3에 업로드해야합니까? – StefMa

+0

Cloudup API를 통해 S3에 업로드하는 이유를 이해하지 못합니까? Cloudup.com에 cloudup api가 있습니까? –

관련 문제