diff --git a/include/class.canned.php b/include/class.canned.php
index a272011a55d3e878ee6e9026c6b083a9c8315364..4ef801205dc1c9b8d3b5875e0045d1326e523ea9 100644
--- a/include/class.canned.php
+++ b/include/class.canned.php
@@ -145,6 +145,10 @@ extends VerySimpleModel {
                 if (!$html) {
                     $resp['response'] = Format::html2text($resp['response'], 90);
                 }
+
+                foreach ($resp['files'] as $f)
+                    $_SESSION[':cannedFiles'][$f['file_id']] = 1;
+
                 return Format::json_encode($resp);
                 break;
             case 'html':
diff --git a/include/class.forms.php b/include/class.forms.php
index 77bc3e578d4fb5b2c8ed295c8697f2344617e8ad..d642209565a79a0cdc468e9e41b8c448608ebd1f 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -3717,6 +3717,10 @@ class FileUploadWidget extends Widget {
         if (isset($_SESSION[':uploadedFiles']))
             $allowed += $_SESSION[':uploadedFiles'];
 
+        // Canned attachments initiated by this session
+        if (isset($_SESSION[':cannedFiles']))
+           $allowed += $_SESSION[':cannedFiles'];
+
         // Parse the files and make sure it's allowed.
         foreach ($files as $info) {
             @list($id, $name) = explode(',', $info, 2);