是否可以将文件保存到网络路径?

发布于 2024-08-30 09:44:27 字数 125 浏览 2 评论 0原文

我想知道是否可以将文件写入到连接的服务器或其他网络路径,而不是本地系统。

我是否必须为此使用外部接口,或者我可以将其委托给 AIR 框架吗?

我非常确定 AIR 具有一定的安全预防措施来防止这种情况发生。

I was wondering if it would be possible to write a file, not to the local system, but to a connected server or other network path.

Would I have to use an external interface for this or can I entrust this to the AIR framework?

I'm pretty sure that AIR has certain security precautions to prevent this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

歌枕肩 2024-09-06 09:44:27

什么样的网络路径? SMB、FTP、HTTP、WebDav,..?

如果它安装在您的本地 PC 上,那么您应该能够像写入任何其他驱动器或文件系统一样对其进行写入。

What kind of network path? SMB, FTP, HTTP, WebDav, .. ?

If it's mounted on your local PC, then you should be able to write to it just like writing to any other drive or filesystem.

蓬勃野心 2024-09-06 09:44:27

在 OSX 中将新文件写入网络驱动器上的文件夹:

var targetDir:File = new File("/Volumes/Data/SomeFolder");
targetDir.createDirectory();  // ensure directory exists, create if not
var targetFile:File = targetDir.resolvePath("newFile.ext");
var fileStream:FileStream = new FileStream();
try {
    fileStream.open(targetFile, FileMode.WRITE);
    fileStream.writeBytes(byteArray);  // or what/however you want to write
    fileStream.close();
} catch (e:Error) {
    trace(e);
}

我假设对于 Windows,您只需交换第一行中的网络驱动器路径。您不应指定协议(例如 file://、smb:// 等); File 构造函数的参数格式是本机路径(就像它出现在终端/命令 shell 中一样)。

要获取 OSX 中的路径,请使用 Finder 导航到目标网络文件夹。开始将文件夹拖动到其他位置,按苹果+空格键打开 Spotlight,然后继续将文件夹拖动到 Spotlight 中。或者,打开终端窗口并将文件夹拖到终端窗口中。

to write a new file to a folder on a networked drive in OSX:

var targetDir:File = new File("/Volumes/Data/SomeFolder");
targetDir.createDirectory();  // ensure directory exists, create if not
var targetFile:File = targetDir.resolvePath("newFile.ext");
var fileStream:FileStream = new FileStream();
try {
    fileStream.open(targetFile, FileMode.WRITE);
    fileStream.writeBytes(byteArray);  // or what/however you want to write
    fileStream.close();
} catch (e:Error) {
    trace(e);
}

i assume for Windows you would just swap the network drive path in the first line. you should not specify a protocol (e.g. file://, smb://, etc); the format of the parameter for the File constructor is the native path (as it would appear in a terminal / command shell).

to get the path in OSX, use the Finder to navigate to the target networked folder. begin dragging the folder somewhere else, hit apple+space to open Spotlight, and continue dragging the folder into Spotlight. alternately, open a Terminal window and drag the folder into the Terminal window.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文