diff --git a/modules/upload/upload.module b/modules/upload/upload.module
index 9225d5a6f2ce1d877e2abc9136c2bd4fd7dfefbb..07aed8d65de5d0d5eef88dd8cb312592d8b0093c 100644
--- a/modules/upload/upload.module
+++ b/modules/upload/upload.module
@@ -506,7 +506,7 @@ function upload_nodeapi(&$node, $op, $teaser) {
         if (!variable_get('clean_url', 0)) {
           $previews = array();
           foreach ($node->files as $file) {
-            if (strpos($file['fid'], 'upload') !== FALSE) {
+            if (strpos($file->fid, 'upload') !== FALSE) {
               $previews[] = $file;
             }
           }
@@ -517,7 +517,7 @@ function upload_nodeapi(&$node, $op, $teaser) {
           // can use the final URL in the body before having actually saved (to
           // place inline images for example).
           foreach ($previews as $file) {
-            $old = file_create_filename($file['filename'], file_create_path());
+            $old = file_create_filename($file->filename, file_create_path());
             $new = url($old);
             $node->body = str_replace($old, $new, $node->body);
             $node->teaser = str_replace($old, $new, $node->teaser);