summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-11-13 08:34:54 -0800
committerAaron Parecki <aaron@parecki.com>2017-11-13 08:34:54 -0800
commit1cb8afa81c0a07db4f970e3a326f20696e3d87e6 (patch)
treeb8181350fac95c98d4aaa33a8441dfd762d047fa
parent6448298d95565e209b9cec3f5387d90a5ddabced (diff)
fix media uploading in html editor
-rw-r--r--lib/helpers.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/helpers.php b/lib/helpers.php
index 08a7eb0..a3d289d 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -124,9 +124,15 @@ function micropub_post($endpoint, $params, $access_token, $file = NULL, $json =
curl_setopt($ch, CURLOPT_POST, true);
if($file) {
- $file_path = $file['tmp_name'];
- $file_content = file_get_contents($file_path);
- $filename = $file['name'];
+ if(is_string($file)) {
+ $file_path = $file;
+ $file_content = file_get_contents($file_path);
+ $filename = 'file';
+ } else {
+ $file_path = $file['tmp_name'];
+ $file_content = file_get_contents($file_path);
+ $filename = $file['name'];
+ }
} else {
$file_path = false;
}