suitelet script should be able to upload the files using drag and drop
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
* @NModuleScope SameAccount
*/
define(['N/ui/serverWidget', 'N/file'], function(serverWidget, file) {
function onRequest(context) {
if (context.request.method === 'GET') {
// Create the form
var form = serverWidget.createForm({
title: 'Drag and Drop Files'
});
// Add a drop zone to the form
var dropZoneField = form.addField({
id: 'custpage_dropzone',
type: serverWidget.FieldType.INLINEHTML,
label: 'Drag and Drop Files Here'
});
// Set up the drop zone HTML
var dropZoneHTML = '<div id="dropZone" style="border: 2px dashed #ccc; padding: 20px; text-align: center;">' +
'<span style="font-size: 18px;">Drag and Drop Files Here</span>' +
'</div>';
dropZoneField.defaultValue = dropZoneHTML;
// Add a hidden field to store the file ID
var fileIdField = form.addField({
id: 'custpage_fileid',
type: serverWidget.FieldType.TEXT,
label: 'File ID'
});
fileIdField.updateDisplayType({
displayType: serverWidget.FieldDisplayType.HIDDEN
});
// Add a submit button to the form
form.addSubmitButton({
label: 'Upload'
});
// Render the form
context.response.writePage(form);
} else if (context.request.method === 'POST') {
// Handle the file upload
var fileObj = file.create({
name: context.request.files.custpage_file.name,
fileType: context.request.files.custpage_file.fileType,
contents: context.request.files.custpage_file.getContents(),
folder: 12807 // Specify the folder ID where you want to save the file
});
var fileId = fileObj.save();
// Redirect to the File Cabinet
context.response.sendRedirect({
type: serverWidget.RedirectType.MEDIA_ITEM,
identifier: fileId
});
}
}
return {
onRequest: onRequest
};
});
I don’t understand what you want as I see no question but you can make your own suitelet with inlinehtml field , and do your one custom HTML drag and drop field there . You can also attach a client script for the event listeners if u like