Description

ลักษณะ

Code Sample

ตัวอย่างโค้ด

import java.io.File;
import java.io.IOException;
import org.joget.apps.form.service.FileUtil;

String recordId = "ID-0001";
String tableName = "crm_contact";
String fileName = "profile_image.png";
 
//Get the uploaded file of a form data record
try {
    File profileImage = FileUtil.getFile(fileName, tableName, recordId);
}catch (IOException e) {}

Methods

กระบวนการ

checkAndUpdateFileName
public static void checkAndUpdateFileName(org.joget.apps.form.model.FormRowSet results, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Method used to check for the duplicate file name of files in the FormRowSet object against the existing files in the target upload directory.

It will update the file name by appending with number if found duplicated.

วิธีที่ใช้ในการตรวจสอบชื่อไฟล์ที่ซ้ำกันของไฟล์ในวัตถุ FormRowSet กับไฟล์ที่มีอยู่ในไดเรกทอรีอัพโหลดเป้าหมาย

มันจะอัปเดตชื่อไฟล์โดยต่อท้ายด้วยหมายเลขหากพบซ้ำกัน

checkAndUpdateFileName
public static void checkAndUpdateFileName(org.joget.apps.form.model.FormRowSet results, java.lang.String tableName, java.lang.String primaryKeyValue)

Method used to check for the duplicate file name of files in the FormRowSet object against the existing files in the target upload directory.

It will update the file name by appending with number if found duplicated.

วิธีที่ใช้ในการตรวจสอบชื่อไฟล์ที่ซ้ำกันของไฟล์ในวัตถุ FormRowSet กับไฟล์ที่มีอยู่ในไดเรกทอรีอัพโหลดเป้าหมาย

มันจะอัปเดตชื่อไฟล์โดยต่อท้ายด้วยหมายเลขหากพบซ้ำกัน

getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()

Utility method to retrieve the ApplicationContext of the system

วิธีการ Utility เพื่อดึง ApplicationContext ของระบบ

getFile
public static java.io.File getFile(java.lang.String fileName, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue) throws java.io.IOException
Gets the file from target upload directory of a form data record

รับไฟล์จากไดเร็กทอรีอัพโหลดเป้าหมายของบันทึกข้อมูลแบบฟอร์ม

getFile
public static java.io.File getFile(java.lang.String fileName, java.lang.String tableName, java.lang.String primaryKeyValue) throws java.io.IOException

Gets the file from target upload directory of a form data record

รับไฟล์จากไดเร็กทอรีอัพโหลดเป้าหมายของบันทึกข้อมูลแบบฟอร์ม

getTableName
public static java.lang.String getTableName (org.joget.apps.form.model.Element form)

Method used to gets the table name from the properties of a Form object

วิธีที่ใช้รับชื่อตารางจากคุณสมบัติของวัตถุแบบฟอร์ม

getUploadPath
public static java.lang.String getUploadPath(org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Gets the target upload directory of a form data record

รับไดเร็กทอรีอัพโหลดเป้าหมายของเร็กคอร์ดข้อมูลฟอร์ม

getUploadPath
public static java.lang.String getUploadPath(java.lang.String tableName, java.lang.String primaryKeyValue)

Gets the target upload directory of a form data record

รับไดเร็กทอรีอัพโหลดเป้าหมายของเร็กคอร์ดข้อมูลฟอร์ม

storeFile
public static void storeFile(java.io.File file, java.lang.String tableName, java.lang.String primaryKeyValue)

Store file to target upload directory of a form data record

จัดเก็บไฟล์เพื่อกำหนดเป้าหมายไดเรกทอรีอัปโหลดของบันทึกข้อมูลฟอร์ม

storeFile
public static void storeFile(org.springframework.web.multipart.MultipartFile file, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Store file to target upload directory of a form data record

จัดเก็บไฟล์เพื่อกำหนดเป้าหมายไดเรกทอรีอัปโหลดของบันทึกข้อมูลฟอร์ม

storeFileFromFormRowSet
public static void storeFileFromFormRowSet(org.joget.apps.form.model.FormRowSet results, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Store files in the FormRowSet to target upload directory of a form data record

จัดเก็บไฟล์ใน FormRowSet เพื่อกำหนดเป้าหมายไดเรกทอรีอัปโหลดของบันทึกข้อมูลฟอร์ม

storeFileFromFormRowSet
public static void storeFileFromFormRowSet(org.joget.apps.form.model.FormRowSet results, java.lang.String tableName, java.lang.String primaryKeyValue)

Store files in the FormRowSet to target upload directory of a form data record

จัดเก็บไฟล์ใน FormRowSet เพื่อกำหนดเป้าหมายไดเรกทอรีอัปโหลดของบันทึกข้อมูลฟอร์ม

validateFileName
public static java.lang.String validateFileName(java.lang.String fileName, java.lang.String path, java.util.Set<java.lang.String> existedFileName)

Validate the file name against the existing files in the target upload directory.

Parameters:

existedFileName - a set of file names which not yet exist in the target upload directory but the current checking file should not has the same file name in it. 

Return the new file name with number appended when duplicate file is found.

ตรวจสอบชื่อไฟล์กับไฟล์ที่มีอยู่ในไดเรกทอรีอัพโหลดเป้าหมาย

พารามิเตอร์:

existedFileName - ชุดของชื่อไฟล์ที่ยังไม่มีอยู่ในไดเรกทอรีอัพโหลดเป้าหมาย แต่ไฟล์การตรวจสอบปัจจุบันไม่ควรมีชื่อไฟล์เหมือนกัน

ส่งคืนชื่อไฟล์ใหม่พร้อมหมายเลขต่อท้ายเมื่อพบไฟล์ที่ซ้ำกัน