File Upload Form Control
👉 Upload files API should return array of objects as shown below.
// Upload file should return this type of response.
[{
"originalName": "photo1.jpeg",
"uploadPath": "/dev/profiles"
}, {
"originalName": "photo2.jpeg",
"uploadPath": "/dev/profiles"
}];
👉 Download file API should return base64 of file. This API will also be used for file preview.
👉 Remove file API should remove file from storage. It will receive below type of object.
Example
let dbMasterConfig: T.IDBMasterConfig = {
form: {
fields: [
[{
label: 'Profile Photo',
control: T.EDBMasterFormControl.file_upload,
path: 'profile_photo',
fileUploadSettings: {
// :userPath = it will be replaced with admin user path by master page automatically.
// :beHostPort = it will be replaced with API Maker backend's protocol and host and port automatically. ex : https://example.com
uploadApiUrl: ':beHostPort/api/custom-api/:userPath/upload-file-test?category=profile_photo',
downloadApiUrl: ':beHostPort/api/custom-api/:userPath/download-file-test?category=profile_photo',
removeApiUrl: ':beHostPort/api/custom-api/:userPath/remove-file-test?category=profile_photo',
multiple: true,
fileLimit: 3,
}
}]
]
}
};