]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttFileHelper.class.php
Fixed a condition for error return on file put.
[timetracker.git] / WEB-INF / lib / ttFileHelper.class.php
index 5c9b385b7f540398a3ff550839adec90041dfaaf..7c8324b6fc7ee0c88b45a6ee6ad2f3a7cc7ee438 100644 (file)
@@ -135,7 +135,7 @@ class ttFileHelper {
       'user_key' => urlencode($fields['user_key']), // May be null.
       'file_name' => urlencode($fields['file_name']),
       'description' => urlencode($fields['description']),
       'user_key' => urlencode($fields['user_key']), // May be null.
       'file_name' => urlencode($fields['file_name']),
       'description' => urlencode($fields['description']),
-      // TODO: add file content here, too. Will this work for large files?
+      'content' => urlencode(file_get_contents($_FILES['newfile']['tmp_name']))
     );
 
     // url-ify the data for the POST.
     );
 
     // url-ify the data for the POST.
@@ -167,7 +167,7 @@ class ttFileHelper {
     $file_key = $result_array['file_key'];
     $error = $result_array['error'];
 
     $file_key = $result_array['file_key'];
     $error = $result_array['error'];
 
-    if (!$file_id || !$file_key) {
+    if ($error || !$file_id || !$file_key) {
       if ($error) {
         // Add an error from file storage facility if we have it.
         $this->errors->add($error);
       if ($error) {
         // Add an error from file storage facility if we have it.
         $this->errors->add($error);