diff --git a/product/ERP5/Document/File.py b/product/ERP5/Document/File.py
index dd62ae8ccab9a2ce3fae21b0ce08b7863d9c91be..cb88962639a09400b46fb35d140d307ee98c21bd 100644
--- a/product/ERP5/Document/File.py
+++ b/product/ERP5/Document/File.py
@@ -106,6 +106,11 @@ class File(Document, CMFFile):
       filename = getattr(file, 'filename', None)
       # if file field is empty(no file is uploaded),
       # filename is empty string.
+      if not filename:
+        # settings the filename before calling
+        # _setFile is required to setup the content_type
+        # property
+        filename = kw.get('filename')
       if filename:
         self._setFilename(filename)
       if self._isNotEmpty(file):