APEX Dropzone插件问题:从Lotus Notes拖拽文件功能失效
From what you've described, this is almost certainly a quirk of Lotus Notes' drag-and-drop behavior rather than a bug in the Dropzone 2 plugin—since you saw the same issue in Daniel Hochleitner's demo app, that rules out a problem with your implementation or the plugin itself.
Why this happens
Lotus Notes handles attachment drag-and-drop differently than Windows Explorer: instead of passing the raw file data directly, it prioritizes sending a preview thumbnail/placeholder object for the attachment. Here's how that breaks your setup:
- In chunked mode: Dropzone can't recognize this non-standard drag object at all, so nothing happens.
- In normal mode: The plugin misinterprets the preview thumbnail as the actual file, resulting in an empty upload. This triggers the
AJAX Callback (pData) ParseErrorbecause the server receives no valid file data, leavingapex_collectionempty.
Fixes you can try
Force Lotus Notes to send the actual file
- Try holding down the
Ctrlkey while dragging the attachment—some Notes versions switch to transferring the raw file instead of the preview when this shortcut is used. - As a reliable workaround: First save the Lotus Notes attachment to your local Windows filesystem, then drag the file from Explorer to the Dropzone area. This ensures the plugin gets a standard file object it can process correctly.
- Try holding down the
Customize Dropzone's drag event handling
You can override the default drag/drop events to manually parse the objects Lotus Notes sends. Notes often includes hidden properties with the real file path or data in thedataTransferobject. Here's a rough code example to get you started:// Target your Dropzone area const dropzoneArea = document.querySelector('.your-dropzone-class'); dropzoneArea.addEventListener('drop', function(e) { e.preventDefault(); const dragItems = e.dataTransfer.items; for (let i = 0; i < dragItems.length; i++) { // Check for valid file data (adjust the type check based on your Notes version) if (dragItems[i].kind === 'file' || dragItems[i].type === 'application/octet-stream') { const actualFile = dragItems[i].getAsFile(); // Pass the real file to Dropzone myDropzone.addFile(actualFile); } } });
Alternative tools
If the above fixes don't work, consider these APEX-compatible upload solutions with better cross-app drag-and-drop support:
- APEX Native File Upload: Oracle's built-in file upload component has stronger compatibility with system-level drag-and-drop, including office app attachments.
- FilePond for APEX: A plugin built on the FilePond library, which has robust logic for parsing non-standard drag objects from various applications.
- Custom AJAX Upload Component: Build a simple custom component using vanilla JavaScript to fully control drag event parsing, tailored to Lotus Notes' behavior.
内容的提问来源于stack exchange,提问作者Michael

