Losing extension when use FileReference download

后端 未结 4 721
醉酒成梦
醉酒成梦 2021-01-18 13:28

I need user download JPEG file from my app, however, when user change the file name the saved file will be downloaded without extension.

For Example: I am using File

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-18 14:26

    This is a known problem with Flash Player. An enhancement request is filed with Adobe. Please visit and vote for it: https://bugs.adobe.com/jira/browse/FP-2014

    It does not seem practical to train users not to rename the file. Here is the workaround I use for my app:

    • The problem only happens on Windows with ActiveX plugin. Detect ActiveX with Capabilities.playerType (only ~25% of users in my experience)

    • If ActiveX plugin, fall back to 'navigateToURL()' to bounce the file on your server. Using this function is less desirable than FileReference.download() because it is less controllable (the browser is in charge, rather than your app), but it results in a Save dialog box where the user can rename the file safely.

提交回复
热议问题