summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-08-17 10:49:06 -0700
committerAaron Parecki <aaron@parecki.com>2017-08-17 10:49:06 -0700
commitae4cbc49c4e6d25923a4e0a3242ea51f1695da22 (patch)
tree9683aa28feea5c9802a2ff7ec625b3c5e029b0c4
parent2b92a713f6476dd0bdd0f49888fdf421f2843baa (diff)
fix errors in previous PR
-rw-r--r--lib/helpers.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/helpers.php b/lib/helpers.php
index bfd0629..08a7eb0 100644
--- a/lib/helpers.php
+++ b/lib/helpers.php
@@ -123,9 +123,13 @@ function micropub_post($endpoint, $params, $access_token, $file = NULL, $json =
curl_setopt($ch, CURLOPT_URL, $endpoint);
curl_setopt($ch, CURLOPT_POST, true);
- $file_path = $file['tmp_name'];
- $file_content = file_get_contents($file_path) . self::EOL;
- $filename = $file['name'];
+ if($file) {
+ $file_path = $file['tmp_name'];
+ $file_content = file_get_contents($file_path);
+ $filename = $file['name'];
+ } else {
+ $file_path = false;
+ }
// Send the access token in both the header and post body to support more clients
// https://github.com/aaronpk/Quill/issues/4