使用PHP上传BigCommerce WebDAV

I'm trying to copy a file to the BigCommerce store.com/dav/content folder. If I set the file size to zero, it will create an empty file, but if the file size is anything other than zero, it doesn't do anything. Also, if I try to copy a .php file, I get $fh = Sabre\DAV\Exception\Forbidden instead of $fh = Resource id #3.

<?php

$credentials = array(
  'username',
  'password',
);

$filename = 'copyme.txt';
$filepath = 'foo/' . $filename;
$filesize = filesize($filepath);
$fh = fopen($filepath, 'r');

$remoteUrl = 'https://store.com/dav/content/';

$ch = curl_init($remoteUrl . $filename);

// curl_setopt($ch, CURLOPT_URL, $remoteUrl . $filename);

curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, implode(':', $credentials));

curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $fh);
curl_setopt($ch, CURLOPT_INFILESIZE, $filesize);

curl_exec($ch);

fclose($fh);

?>