使用 FileReference 下载时丢失扩展名 [英] Losing extension when use FileReference download

查看:28
本文介绍了使用 FileReference 下载时丢失扩展名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要用户从我的应用程序下载 JPEG 文件,但是,当用户更改文件名时,保存的文件将被下载而没有扩展名.

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

例如:我正在使用 FileReference.download() 并将默认文件名设置为demoPic.jpg",并且未显示用户的 Windows 系统设置控制文件扩展名.因此,当对话框打开下载窗口时,只有demoPic"显示为文件名.如果用户保存文件而不更改文件名,则保存的文件就可以了.但如果用户更改文件名,则下载文件将被保存为不带扩展名.当用户通过 flex 代码忘记文件扩展名时,是否可以将文件扩展名添加到文件名中?

For Example: I am using FileReference.download() and set the default filename as "demoPic.jpg" and user's windows system setting control file extension not being shown. So when the dialog opens a download window, only "demoPic" shown as the filename. If user saved file without changing filename, the saved file will be OK. But if user change file name, the download file will be saved without extension. is it possible to add file extension to filename when user forget it by flex code?

推荐答案

我遇到了同样的问题,直到现在才解决.似乎是 flash + windows 的问题.:(很抱歉通知,但我没有找到任何修复.

I have the same problem and was not able to fix it until now. It seems it is a problem with flash + windows. :( sorry to inform but I did not found any fix.

如果这可以称为一种解决方法,那么以某种方式警告用户并要求他们在重命名文件时也放置扩展名.

If this can be called a workaround, is somehow to warn users and ask them to place also the extension when they rename the file.

这篇关于使用 FileReference 下载时丢失扩展名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆