diff --git a/product/ERP5/Document/File.py b/product/ERP5/Document/File.py
index 3703a300e421e5feaff2bd1c2aaab9f0689de3bd..a2d0bcea725c1647ea997e5da1cb12790448cef6 100644
--- a/product/ERP5/Document/File.py
+++ b/product/ERP5/Document/File.py
@@ -110,14 +110,14 @@ class File(Document, CMFFile, ConversionCacheMixin):
     if kw.has_key('file'):
       file = kw.get('file')
       precondition = kw.get('precondition')
-      if self._isNotEmpty(file):
-        self._setFile(file, precondition=precondition)
       if set_filename__:
         filename = getattr(file, 'filename', None)
         # if file field is empty(no file is uploaded),
         # filename is empty string.
         if filename not in (None, ''):
-          kw['source_reference'] = filename
+          self._setSourceReference(filename)
+      if self._isNotEmpty(file):
+        self._setFile(file, precondition=precondition)
       del kw['file']
     Base._edit(self, **kw)