--- inline_upload.module.orig	2009-04-16 12:49:02.000000000 -0500
+++ inline_upload.module	2009-04-17 15:36:15.000000000 -0500
@@ -28,7 +28,11 @@ function inline_upload_inline($op, $para
         'file' => array(
           '#title' => t('File'),
           '#description' => t('An id or name of a file to render.'),
-          '#required' => TRUE,
+        ),
+        'attachid' => array(
+          '#title' => t('Attachment id'),
+          '#description' => t('Numberical ID of the node attachment to render.'),
+          '#type' => 'int',
         ),
         'title' => array(
           '#title' => t('Title'),
@@ -66,11 +70,15 @@ function inline_upload_inline($op, $para
         }
       }
       // Convert a numeric file reference to a named one.
+      /* 
+      // No longer accept integer parameters to file
+      // attachid is used instead
       if (is_int($params['file']) && isset($params['#node'])) {
         if (isset($params['#node']->files[$params['file']])) {
           $params['file'] = $params['#node']->files[$params['file']]->filename;
         }
-      }
+      }*/
+
       return $params;
 
     case 'render':
@@ -80,11 +88,18 @@ function inline_upload_inline($op, $para
       }
       // Find the referenced file.
       $file = '';
+      $attach_count = 1 ;
       foreach ($params['#node']->files as $node_file) {
-        if ($node_file->filename == $params['file']) {
+        if ((isset($params['file'])) && ($node_file->filename == $params['file'])) {
           $file = $node_file;
           break;
+        } else if (isset($params['attachid'])) {
+          if ($attach_count == $params['attachid']) {
+             $file = $node_file;
+             break;
+          }
         }
+        $attach_count = $attach_count + 1;
       }
       // Alter the file object on node previews.
       inline_upload_prepare_file_object($file);
