Is it possible to upload a complete directory stru

2019-08-23 13:12发布

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?

2条回答
【Aperson】
2楼-- · 2019-08-23 13:55

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-08-23 14:10

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).

查看更多
登录 后发表回答