Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Good Day Paik,
Basically the concept of of file upload can be understood with this concept :
Files uploaded in the form is saved in \wflow\app_formuploads .
1 ) If you want to save to a different folder, you can define the path in general settings, if not mistaken.
general settings > Uploaded File Storage Base Path
2 )There is also a KB for uploading to external storage integrated with Amazon S3 : File Upload Form Element Integrated with Amazon S3
3 )You can also try out this method File handling in Bean Shell Form Store Binder.
The provided code from the link above currently stores uploaded files in the local filesystem. Here's how you can alter it to store them on an external server:
1. Choose a Storage Solution:
There are several ways to store files on an external server. Here are some options:
2. Modify the storeFileFromFormRowSet
method:
This method currently uses FileUtil.storeFileFromFormRowSet
to store files locally. You'll need to replace that with code specific to your chosen storage solution. Here's a general outline:
Java
private void storeFilesOnExternalServer(FormRowSet rows, String tableName, String primaryKeyValue) throws Exception {
// Loop through each row with uploaded files
for (FormRow row : rows) {
String fileField = "files"; // Replace with your actual file field name
String files = row.getProperty(fileField);
if (files == null || files.isEmpty()) {
continue;
}
String[] filePaths = files.split(";");
for (String filePath : filePaths) {
// Get the actual file content (replace with your logic)
byte[] fileContent = getFileContent(filePath);
// Upload the file to the external server (replace with your logic)
uploadFileToExternalServer(filePath, fileContent, tableName, primaryKeyValue);
}
}
}
Hope it helps
Cheers!
I want to upload files from joget to a server outside of joget and retrieve those files