Add additional check to prevent sending direct uploads with JSON requests
[shpub.git] / src / shpub / Request.php
index 8262863..0713872 100644 (file)
@@ -148,6 +148,12 @@ class Request
      */
     public function addUpload($fieldName, $fileNames)
     {
+        if ($this->directUpload && $this->sendAsJson) {
+            throw new \Exception(
+                'Cannot do direct upload with JSON requests'
+            );
+        }
+
         if ($this->host->endpoints->media === null
             || $this->directUpload
         ) {