Is it possible to upload a complete directory structure with Flex?

南楼画角 提交于 2019-12-13 06:25:58

问题


Is it possible to upload a complete folder with subdirectories and files (in the subdirectories) in Flex?

I am using a Flex / BlazeDS / Spring application. The question is not how to transfer the data to the server. The question is: if it is possible to get access to the files and subfolders (recursive) with Flex?


回答1:


If you're working with AIR, then yes. Look a the File class. It is a reference to either a file or directory. You can tell if it is a directory using the isDirectory attribute. You can use getDirectoryListing to get a list of all files and subdirectories in a directory.

As far as I know, you'll then have to upload things one by one to the server, though.

If you are using Flex in a web based app, I do not believe what you're trying to accomplish is possible.




回答2:


No, not if you are talking about a Flex app running in a web browser. In an AIR application it is probably possible, but not in Flash Player in a browser.

The security sandbox doesn't give that kind of file system access, files are only available when selected by a user, via some user action like clicking a button. And then you only get a reference to the file, so it can be read or uploaded, there is no mechanism to for example get the local path to the file as a string or such, and no way to check for subfolders (unless it's an app for the AIR runtime).



来源:https://stackoverflow.com/questions/4596526/is-it-possible-to-upload-a-complete-directory-structure-with-flex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!