diff --git a/modules/Documents/models/Record.php b/modules/Documents/models/Record.php
index 44cd7b29e373f549c1f61e9891b69d663cc266fe..c87e720781ac0bcc00de464490d6bc9df566fbae 100644
--- a/modules/Documents/models/Record.php
+++ b/modules/Documents/models/Record.php
@@ -77,24 +77,29 @@ class Documents_Record_Model extends Vtiger_Record_Model {
 
 			if ($this->get('filelocationtype') == 'I') {
 				$fileName = html_entity_decode($fileName, ENT_QUOTES, vglobal('default_charset'));
-				$savedFile = $fileDetails['attachmentsid']."_".$storedFileName;
-
-				while(ob_get_level()) {
-					ob_end_clean();
-				}
-				$fileSize = filesize($filePath.$savedFile);
-				$fileSize = $fileSize + ($fileSize % 1024);
-
-				if (fopen($filePath.$savedFile, "r")) {
-					$fileContent = fread(fopen($filePath.$savedFile, "r"), $fileSize);
-
-					header("Content-type: ".$fileDetails['type']);
-					header("Pragma: public");
-					header("Cache-Control: private");
-					header("Content-Disposition: attachment; filename=\"$fileName\"");
-					header("Content-Description: PHP Generated Data");
-                    header("Content-Encoding: none");
-				}
+                if (!empty($fileName)) {
+                    if(!empty($storedFileName)){
+                        $savedFile = $fileDetails['attachmentsid']."_".$storedFileName;
+                    }else if(is_null($storedFileName)){
+                        $savedFile = $fileDetails['attachmentsid']."_".$fileName;
+                    }
+                    while(ob_get_level()) {
+                        ob_end_clean();
+                    }
+                    $fileSize = filesize($filePath.$savedFile);
+                    $fileSize = $fileSize + ($fileSize % 1024);
+
+                    if (fopen($filePath.$savedFile, "r")) {
+                        $fileContent = fread(fopen($filePath.$savedFile, "r"), $fileSize);
+
+                        header("Content-type: ".$fileDetails['type']);
+                        header("Pragma: public");
+                        header("Cache-Control: private");
+                        header("Content-Disposition: attachment; filename=\"$fileName\"");
+                        header("Content-Description: PHP Generated Data");
+                        header("Content-Encoding: none");
+                    }
+                }
 			}
 		}
 		echo $fileContent;
diff --git a/modules/Emails/actions/DownloadFile.php b/modules/Emails/actions/DownloadFile.php
index 882a1ddf51926287e7d310f67133f82b6577bf0b..a0a0b11df31c4fbe4ab12095e33d8cfd6dd5a08b 100644
--- a/modules/Emails/actions/DownloadFile.php
+++ b/modules/Emails/actions/DownloadFile.php
@@ -36,17 +36,23 @@ class Emails_DownloadFile_Action extends Vtiger_Action_Controller {
             $filepath = $row["path"];
             $name = decode_html($name);
             $storedFileName = $row['storedname'];
-            $saved_filename = $attachmentId."_". $storedFileName;
-            $disk_file_size = filesize($filepath.$saved_filename);
-            $filesize = $disk_file_size + ($disk_file_size % 1024);
-            $fileContent = fread(fopen($filepath.$saved_filename, "r"), $filesize);
+            if (!empty($name)) {
+                if(!empty($storedFileName)){
+                    $saved_filename = $attachmentId."_". $storedFileName;
+                }else if(is_null($storedFileName)){
+                    $saved_filename = $attachmentId."_". $name;
+                }
+                $disk_file_size = filesize($filepath.$saved_filename);
+                $filesize = $disk_file_size + ($disk_file_size % 1024);
+                $fileContent = fread(fopen($filepath.$saved_filename, "r"), $filesize);
 
-            header("Content-type: $fileType");
-            header("Pragma: public");
-            header("Cache-Control: private");
-            header("Content-Disposition: attachment; filename=$name");
-            header("Content-Description: PHP Generated Data");
-            echo $fileContent;
+                header("Content-type: $fileType");
+                header("Pragma: public");
+                header("Cache-Control: private");
+                header("Content-Disposition: attachment; filename=$name");
+                header("Content-Description: PHP Generated Data");
+                echo $fileContent;
+            }
         }
     }
 }
diff --git a/modules/Migration/schema/711_to_720.php b/modules/Migration/schema/711_to_720.php
index fa7be894350a8f5086a0cd9b59d7acfab11fafde..abf2134192ac5e4cda3f6e6cb73b21587bae49ca 100644
--- a/modules/Migration/schema/711_to_720.php
+++ b/modules/Migration/schema/711_to_720.php
@@ -13,5 +13,5 @@ if (defined('VTIGER_UPGRADE')) {
 	$db = PearDatabase::getInstance();
 
 	// Added column storedname for vtiger_attachments to support reverse mapping.
-	$db->pquery('ALTER TABLE vtiger_attachments ADD COLUMN storedname varchar(255) NOT NULL AFTER path', array());
+	$db->pquery('ALTER TABLE vtiger_attachments ADD COLUMN storedname varchar(255) NULL AFTER path', array());
 }
diff --git a/modules/Vtiger/helpers/ShowFile.php b/modules/Vtiger/helpers/ShowFile.php
index 8baa67c7a30e77c4ca1a0d63155479b377856249..7ac64cc0e30a0d3905926aebb88fd2876f2322b3 100644
--- a/modules/Vtiger/helpers/ShowFile.php
+++ b/modules/Vtiger/helpers/ShowFile.php
@@ -36,21 +36,25 @@ class Vtiger_ShowFile_Helper {
 			 * While saving the document applying decode_html to save in DB, but this is not happening for the images
 			 * This save happens from mailroom, inbox, record save, document save etc..
 			 */
-			if (!empty($encFileName) && !empty($storedFileName)) {
-				$finalFilePath = $filePath.$fileId.'_'.$storedFileName;
-				$isFileExist = false;
-				if (file_exists($finalFilePath)) {
-					$isFileExist = true;
-				} else {
-					$finalFilePath = $filePath.$fileId.'_'.$sanitizedFileName;
-					if (file_exists($finalFilePath)) {
-						$isFileExist = true;
-					}
-				}
-				if ($isFileExist) {
-					Vtiger_ShowFile_Helper::show($finalFilePath,$fileType);
-				}
-			}
+			if (!empty($encFileName)) {
+                if(!empty($storedFileName)){
+                    $finalFilePath = $filePath.$fileId.'_'.$storedFileName;
+                }else if(is_null($storedFileName)){
+                    $finalFilePath = $filePath.$fileId.'_'.$encFileName;
+                }
+                $isFileExist = false;
+                if (file_exists($finalFilePath)) {
+                    $isFileExist = true;
+                } else {
+                    $finalFilePath = $filePath.$fileId.'_'.$sanitizedFileName;
+                    if (file_exists($finalFilePath)) {
+                        $isFileExist = true;
+                    }
+                }
+                if ($isFileExist) {
+                    Vtiger_ShowFile_Helper::show($finalFilePath,$fileType);
+                }
+            }
 		}
 	}
 
diff --git a/modules/Vtiger/models/Record.php b/modules/Vtiger/models/Record.php
index 00e4b3198e34a12bcc167fe649196b676bf2c2b7..c6d9a683f1242d36afbde66365623087ea41629d 100644
--- a/modules/Vtiger/models/Record.php
+++ b/modules/Vtiger/models/Record.php
@@ -593,18 +593,24 @@ class Vtiger_Record_Model extends Vtiger_Base_Model {
 			$fileName = $fileDetails['name'];
             $storedFileName = $fileDetails['storedname'];
 			$fileName = html_entity_decode($fileName, ENT_QUOTES, vglobal('default_charset'));
-			$savedFile = $fileDetails['attachmentsid']."_".$storedFileName;
-			$fileSize = filesize($filePath.$savedFile);
-			$fileSize = $fileSize + ($fileSize % 1024);
-			if (fopen($filePath.$savedFile, "r")) {
-				$fileContent = fread(fopen($filePath.$savedFile, "r"), $fileSize);
-				header("Content-type: ".$fileDetails['type']);
-				header("Pragma: public");
-				header("Cache-Control: private");
-				header("Content-Disposition: attachment; filename=\"$fileName\"");
-				header("Content-Description: PHP Generated Data");
-				header("Content-Encoding: none");
-			}
+            if (!empty($fileName)) {
+                if(!empty($storedFileName)){
+                    $savedFile = $fileDetails['attachmentsid']."_".$storedFileName;
+                }else if(is_null($storedFileName)){
+                    $savedFile = $fileDetails['attachmentsid']."_".$fileName;
+                }
+                $fileSize = filesize($filePath.$savedFile);
+                $fileSize = $fileSize + ($fileSize % 1024);
+                if (fopen($filePath.$savedFile, "r")) {
+                    $fileContent = fread(fopen($filePath.$savedFile, "r"), $fileSize);
+                    header("Content-type: ".$fileDetails['type']);
+                    header("Pragma: public");
+                    header("Cache-Control: private");
+                    header("Content-Disposition: attachment; filename=\"$fileName\"");
+                    header("Content-Description: PHP Generated Data");
+                    header("Content-Encoding: none");
+                }
+            }
 		}
 		echo $fileContent;
 	}
diff --git a/schema/DatabaseSchema.xml b/schema/DatabaseSchema.xml
index 68d7d560e0594184c49676ffdc546d81fb4693d8..bc7399e40bbc004148d11b1b665473ff63de33c0 100644
--- a/schema/DatabaseSchema.xml
+++ b/schema/DatabaseSchema.xml
@@ -1014,6 +1014,7 @@
 		<field name="description" type="X" />
 		<field name="type" type="C" size="100" />
 		<field name="path" type="X" />
+                <field name="storedname" type="C" size="255" />
 		<field name="subject" type="C" size="255" />
 		<index name="attachments_attachmentsid_idx">
 			<col>attachmentsid</col>
diff --git a/vtigerversion.php b/vtigerversion.php
index 47cdbef270e0ec732b927ab8e50d1a994d587378..f52201a7ee0d51ef42c1951bce09f6757b97dae8 100644
--- a/vtigerversion.php
+++ b/vtigerversion.php
@@ -8,9 +8,9 @@
  * All Rights Reserved.
  ************************************************************************************/
 
-$patch_version = '20180308'; // -ve timestamp before release, +ve timestamp after release.
+$patch_version = '-20190904'; // -ve timestamp before release, +ve timestamp after release.
 $modified_database = '';
-$vtiger_current_version = '7.1.1';
+$vtiger_current_version = '7.2.0';
 $_SESSION['vtiger_version'] = $vtiger_current_version;
 
 ?>