FileManager

Description

  • org.joget.commons.util.FileManager
  • Under wflow-commons module
  • Utility methods used by the system to manage temporary files

 

Code Sample

import java.io.File;
import org.joget.commons.util.FileManager
 
String path = "2dcd27eb-c0a80050-32ea05d3-608d46dd/test.txt";
  
//Get the file from temporary folder
File file = FileManager.getFileByPath(path);

 

Fields

THUMBNAIL_SIZE

public final static Integer THUMBNAIL_SIZE = 60; 

Default size used to generate thumbnail.

 

THUMBNAIL_EXT

public final static String THUMBNAIL_EXT = ".thumb.jpg"; 

File extension used for generated thumbnail.

 

Methods

createThumbnail

public static void createThumbnail(java.lang.String path, java.lang.Integer thumbWidth, java.lang.Integer thumbHeight)

Generates a thumbnail of a image file in temporary files folder by relative path.

 

deleteFile

public static void deleteFile(java.io.File file)

Deletes a file

 

deleteFileByPath

public static void deleteFileByPath(java.lang.String path)

Deletes the temporary file from temporary files folder by relative path.

 

getBaseDirectory

public static java.lang.String getBaseDirectory()

Gets directory path to temporary files folder.

 

getFileByPath

public static java.io.File getFileByPath(java.lang.String path)

Gets the temporary file from temporary files folder by relative path.

 

storeFile

public static java.lang.String storeFile(org.springframework.web.multipart.MultipartFile file)

Stores files post to the HTTP request to temporary files folder.

 
Created by Damian Last modified by Aadrian on Dec 13, 2024