Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

380
Views
PHP CURL PUT from Amazon S3 stream wrapper (tcp stream)

I'm trying to (PHP) cURL PUT a file from Amazon S3 to Vimeo using S3 stream wrapper (s3://...) and getting the follow error:

curl_setopt_array(): cannot represent a stream of type tcp_socket/ssl as a STDIO FILE in [...]

Is there a way to cURL PUT a remote file? This are the curl opts being sent:

$curl_opts = array(
  CURLOPT_PUT => true,
  CURLOPT_INFILE => $file, // this refers to 's3://path-to-object'
  CURLOPT_INFILESIZE => $size,
  CURLOPT_UPLOAD => true,
  CURLOPT_HTTPHEADER => array('Expect: ', 'Content-Range: replaced...')
);
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Save the file to your local server before PUTting it:

$file = tempnam(sys_get_temp_dir(), "foo");
$data = file_get_contents("s3://path-to-object");
$size = strlen($data);
file_put_contents($file, $data);
$curl_opts = array(
  CURLOPT_PUT => true,
  CURLOPT_INFILE => $file, // this refers to 's3://path-to-object'
  CURLOPT_INFILESIZE => $size,
  CURLOPT_UPLOAD => true,
  CURLOPT_HTTPHEADER => array('Expect: ', 'Content-Range: replaced...')
);
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!