| Table of Contents |
|---|
Description
| Thai |
|---|
ลักษณะ |
- org.joget.commons.util.FileStore
- Under wflow-commons module
- Utility class to act as a temporary holder to manage the files posted in a HTTP request
Code Sample
| Thai |
|---|
ตัวอย่างโค้ด |
| Code Block | ||
|---|---|---|
| ||
import org.joget.commons.util.FileLimitException;
import org.joget.commons.util.FileStore;
import org.joget.commons.util.LogUtil;
import org.springframework.web.multipart.MultipartFile;
String uploadFieldName = "csvImport";
//Gets file
try {
MultipartFile csvFile = FileStore.getFile(uploadFieldName);
} catch (FileLimitException e) {
LogUtil.error("", e, "File received from " + uploadFieldName + " is exceeded file size limit of " + FileStore.getFileSizeLimit() + "MB.");
} |
Methods
| Thai |
|---|
กระบวนการ |
clear
public static void clear()
Method used by the system to clear the ThreadLocal object after an HTTP request is finished processing
| Thai |
|---|
วิธีการที่ใช้โดยระบบเพื่อล้างวัตถุ ThreadLocal หลังจากการร้องขอ HTTP เสร็จสิ้นการประมวลผล |
getFile
public static org.springframework.web.multipart.MultipartFile getFile(java.lang.String name) throws org.joget.commons.util.FileLimitException
Convenient method to retrieves the posted file in current HTTP request based on field name
| Thai |
|---|
วิธีที่สะดวกในการดึงไฟล์ที่โพสต์ในคำขอ HTTP ปัจจุบันตามชื่อฟิลด์ |
getFiles
public static org.springframework.web.multipart.MultipartFile[] getFiles(java.lang.String name) throws org.joget.commons.util.FileLimitException
Method to retrieves the posted files in current HTTP request based on field name
| Thai |
|---|
วิธีการดึงข้อมูลไฟล์ที่โพสต์ในคำขอ HTTP ปัจจุบันตามชื่อฟิลด์ |
getFileErrorList
public static java.util.Collection<java.lang.String> getFileErrorList()
Gets a list of the field name which has file exceed the file limit in the current HTTP request
| Thai |
|---|
รับรายการชื่อฟิลด์ที่มีไฟล์เกินขีด จำกัด ไฟล์ในคำขอ HTTP ปัจจุบัน |
getFileMap
public static java.util.Map<java.lang.String, org.springframework.web.multipart.MultipartFile[]> getFileMap()
...
Return a map of field name & its files
| Thai |
|---|
รับไฟล์ที่โพสต์ทั้งหมดของคำขอ HTTP ปัจจุบัน ส่งคืนแผนที่ของชื่อฟิลด์ & ไฟล์ของมัน |
getFileNames
public static java.util.Iterator<java.lang.String> getFileNames()
Gets the Iterator of all upload field name of the current HTTP request
| Thai |
|---|
รับค่า Iterator ของชื่อฟิลด์อัพโหลดทั้งหมดของคำขอ HTTP ปัจจุบัน |
getFileSizeLimit
public static int getFileSizeLimit()
Get the file size limit of the system in MB
| Thai |
|---|
รับขนาดไฟล์ที่ จำกัด ของระบบเป็น MB |
getFileSizeLimitLong
public static long getFileSizeLimitLong()
Get the file size limit of the system in byte
| Thai |
|---|
รับขีด จำกัด ขนาดไฟล์ของระบบเป็นไบต์ |
setFileMap
public static void setFileMap(java.util.Map<java.lang.String, org.springframework.web.multipart.MultipartFile[]> fileMap)
...
fileMap - a map of field name & its files
| Thai |
|---|
ตั้งค่าไฟล์ที่โพสต์ในคำขอ HTTP เป็นวัตถุ ThreadLocal สำหรับการจัดเก็บชั่วคราว พารามิเตอร์: fileMap - แผนที่ชื่อฟิลด์และไฟล์ |
updateFileSizeLimit
public static void updateFileSizeLimit()
Method call to refresh the file size limit based on system setting
...
| Thai |
|---|
การเรียกเมธอดเพื่อรีเฟรชขีด จำกัด ขนาดไฟล์ตามการตั้งค่าระบบ |