16
votes

I am using valums fileuploader using jQuery to implement drag and drop functionality in my application. The functionality was running smoothly until one of the users tried the following.

The user received an email with an attachment. He tried to drag and drop the attachment directly from the email client(Outlook) onto the browser and in the drop area. The upload was unsuccessful. But when he saved the file into his filesystem and then drag and dropped the file the upload was successful.

Can anyone let me know what happens in background when the user drags a attachment directly from email? Does it save the file in a temp location? If so then the why does the upload fail?

3

3 Answers

26
votes

All browsers are only expecting the actual file drag/drop format (CF_HDROP), but when dragging from Outlook, there is no file on the filesystem. What you get is the CF_FILEDESCRIPTOR and CF_FILECONTENTS formats. No browser that I know of (not even IE), knows how to handle that.

8
votes

I found a free solution to your drag and drop problem: https://tonyfederer.github.io/OutlookFileDrag/

From the website:

When you try to drag and drop from Outlook, Outlook correctly identifies the format as virtual files (CFSTR_FILEDESCRIPTORW) since the files do not exist directly on disk. Instead, they are contained in a PST file, OST file, or on an Exchange server.

However, many applications do not support, such as web browers and most .NET/ Java applications.

To work around this issue, Outlook File Drag hooks the Outlook drag and drop process and adds support for physical files (CF_HDROP). When the application asks for the physical files, the files are saved to a temp folder.

I looked at https://outlook2web.com/ and https://www.wilutions.info/ddaddin-download.html

but the free one works fine, and it's open source!

June 2020 Update: Chrome and Edge can now interface with the latest Outlook, FireFox still has an open ticket though: https://bugzilla.mozilla.org/show_bug.cgi?id=580928

2
votes

FWIW dragging from client to browser now works with Microsoft Edge and Outlook.

Tested with Outlook 2016 and Edge 42.17134.1.0