文件目标选择器 [英] File Destination Chooser

查看:144
本文介绍了文件目标选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个文件目标选择器像选择保存从浏览器下载文件的目的地。但我不知道如何计算出来。

I would like to create a file destination chooser as like choosing save destination of download file from browser. But I have no idea how to figure it out.

我想创建一些文件,并将它们保存在从用户选择的地方。类似的,在Eclipse IDE中创建新的Java类和浏览器的源文件夹。

I want to create some files and save them at a place that choose from user. Similar with create new Java Class in Eclipse IDE and browser for source folder.

我已经找到了很多的文件的上传者但这些浏览特定的文件夹没有

I had found many File-Uploaders but these were browse for specific files not folders.

我的问题有什么建议?我真的AP preciate您的建议。

Any suggestions for my problem? I would really appreciate your suggestions.

特别是我比较preFER使用Java创建(的但不摇摆,因为我创建Web项目的),但我也可以使用JavaScript或其他一些有用的库。

Especially I am more prefer creating with Java (but not swing because I am creating web project) but I can also used by JavaScript or some other useful libs.

推荐答案

如果您想自定义文件是在浏览器下载的方式,即无法通过标准的浏览器功能(HTML / CSS / JavaScript)的实现。

If you want to customize the way a file is downloaded in a browser, that CANNOT be done via standard browser functionality (HTML/CSS/Javascript).

根据在响应中发送要么做两件事之一后,文件下载内容处置 HTTP标头的值的浏览器:

The browser depending on the value of the Content-Disposition HTTP header sent in the response will either do one of two things upon file download:


  • 尝试解析取决于它的扩展名的文件,使文件,如果它是HTML,显示它,如果的XML等

  • 如果内容处置设置为附件,它会打开一个非常基本的弹出问在哪里保存文件中,没有为弹出并不能够控制或者定制成为可能。

  • Try to parse the file depending on it's extension, render the file if it's HTML, display it if's xml etc
  • If Content-Dispositionis set to attachment, it will open a very basic popup asking where to save the file, there is no control or customization possible for the popup.

如果你想在浏览器中比这更多的功能,那么你就需要一个applet(或其他一些插件的用户将必须安装)。

If you want more functionality than that in a browser, then you need an applet (or some other plugin the user would have to install).

但由于在浏览器去年的很大一部分用于Java的安全问题,这几天浏览器都不愿意来运行Applet和他们问了很多用户的确认,即使已经安装在用户的Java。

But due to security problems for Java in the browser for a large part of last year, these days browsers are reluctant to run applets and they ask for many user confirmations, even if the user already has Java installed.

如果该网站的用户必须下载Java,点击弹出几个为了使文件下载窗口小部件的工作,他们可能会从网站上浏览了。

If the users of the site have to download Java and click several popups in order for the file download widget to work, they will probably navigate away from the site.

小程序,这些天过时的技术,最好避免,所以在网页浏览器的基本弹出保存文件是目前最实用的解决方案。

Applets are these days obsolete technology that is best avoided, so in a web browser the basic popup to save files is currently the most practical solution.

这篇关于文件目标选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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