diff --git a/src/pages/Proof/Reply_Public/ProofForm.js b/src/pages/Proof/Reply_Public/ProofForm.js
index a994122c..cc25d27a 100644
--- a/src/pages/Proof/Reply_Public/ProofForm.js
+++ b/src/pages/Proof/Reply_Public/ProofForm.js
@@ -185,12 +185,25 @@ const FormPanel = ({ formData }) => {
}
});
+ const getFileExtension = (fileName) => {
+ const name = (fileName || "").toLowerCase();
+ const dot = name.lastIndexOf(".");
+ if (dot <= 0 || dot === name.length - 1) {
+ return "";
+ }
+ return name.substring(dot + 1);
+ }
+
+ const isAcceptedProofReplyFile = (fileName) => {
+ return ["pdf", "jpg", "jpeg", "png"].includes(getFileExtension(fileName));
+ }
+
const readFile = (event) => {
let file = event.target.files[0];
if (file) {
- if (!file.name.toLowerCase().substr(file.name.length - 4).includes(".pdf")) {
+ if (!isAcceptedProofReplyFile(file.name)) {
setWarningTitle(intl.formatMessage({ id: "attention" }))
- setWarningText(intl.formatMessage({ id: 'requireValidFileWithPdfFormat' }));
+ setWarningText(intl.formatMessage({ id: 'requireValidFileWithProofReplyFormat' }));
setIsWarningPopUp(true);
document.getElementById("uploadFileBtn").value = "";
return;
@@ -630,6 +643,11 @@ const FormPanel = ({ formData }) => {
:
+
+
+
+
+
@@ -660,7 +678,7 @@ const FormPanel = ({ formData }) => {
id="uploadFileBtn"
name="file"
type="file"
- accept=".pdf"
+ accept=".pdf,.jpg,.jpeg,.png,application/pdf,image/jpeg,image/png"
style={{ display: 'none' }}
disabled={attachments.length >= (formik.values.groupType === "Private Bill" ? 2 : 1)}
onChange={(event) => {
diff --git a/src/translations/en.json b/src/translations/en.json
index a44baa48..edb8a832 100644
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -44,6 +44,8 @@
"requireFile": "Please select a file to upload",
"requireValidFile": "Please upload a valid file",
"requireValidFileWithPdfFormat": "Please upload a valid file (file format: .pdf)",
+ "requireValidFileWithProofReplyFormat": "Please upload a valid file (file format: .pdf, .jpg, .jpeg, .png)",
+ "acceptProofReplyFileFormats": "Accept file formats: pdf, jpg, jpeg and png.",
"requireValidFileWithFormat": "Please upload a valid file (file format: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "Application submitted successfully",
"noMoreThen40Words": "Must not exceed 40 characters",
diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json
index 8ad9d772..76f3ac2f 100644
--- a/src/translations/zh-CN.json
+++ b/src/translations/zh-CN.json
@@ -44,6 +44,8 @@
"requireFile": "请选择上传档案",
"requireValidFile": "请上传有效档案",
"requireValidFileWithPdfFormat": "请上传有效档案 (档案格式: .pdf)",
+ "requireValidFileWithProofReplyFormat": "请上传有效档案 (档案格式: .pdf, .jpg, .jpeg, .png)",
+ "acceptProofReplyFileFormats": "接受档案格式:pdf、jpg、jpeg 及 png。",
"requireValidFileWithFormat": "请上传有效档案 (档案格式: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "申请提交成功",
"noMoreThen40Words": "不得超过 40 个字符",
diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json
index 71998691..11c20259 100644
--- a/src/translations/zh-HK.json
+++ b/src/translations/zh-HK.json
@@ -44,6 +44,8 @@
"requireFile": "請選擇上傳檔案",
"requireValidFile": "請上傳有效檔案",
"requireValidFileWithPdfFormat": "請上傳有效檔案 (檔案格式: .pdf)",
+ "requireValidFileWithProofReplyFormat": "請上傳有效檔案 (檔案格式: .pdf, .jpg, .jpeg, .png)",
+ "acceptProofReplyFileFormats": "接受檔案格式:pdf、jpg、jpeg 及 png。",
"requireValidFileWithFormat": "請上傳有效檔案 (檔案格式: .doc, .docx, .xls, .xlsx)",
"submissionSuccess": "申請提交成功",
"noMoreThen40Words": "不得超過 40 個字符",