Silverlight FTP 上传 [英] Silverlight Ftp Upload

查看:20
本文介绍了Silverlight FTP 上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 silverlight 应用程序将文件 ftp 到服务器.在服务器文件系统上上传文件的位置存在于 Web 服务器的沙箱区域之外.在这种情况下,Web 服务器根目录存在于C: estwww",上传文件的位置将存在于C:UserUploads".在这个场景中,我不确定 Http POST 是否有效(不使用 Web 服务器根目录).我只需要将用户选择的文件上传到沙盒之外可能存在的不同位置.对于silverlight,我认为套接字是我最后的选择,因为silverlight 的端口范围是4502-4532.我可以使用 WebClient 和 Http POST 来做到这一点吗?我可以通过 silverlight 或 javascript 建立 ftp 连接吗?

I'm working on trying to ftp a file to the server through a silverlight application. Where the location to upload the file on server file system, exists outside the sandbox area for the web server. In this case the web server root exists at "C: estwww" and the location to upload the file will exist at "C:UserUploads". In this scenerio i'm not sure if Http POST will work (doesn't that use the web server root). I just need to upload the file selected by the user to a different location that may exist outside the sandbox. With silverlight i'm thinking sockets are my last option based on the limited port range for silverlight being 4502-4532. Can i do this using WebClient and Http POST? Can i make an ftp connection through silverlight or javascript?

推荐答案

这是一个有趣的场景,因为听起来你是在同一台机器(客户端和服务器)上做这一切.我正在回答含糊不清的原始问题,并且希望获得更多数据来帮助完全回答这个问题.

This is an interesting scenario, since it sounds like you are doing this all on the same machine (both client and server). I am responding to the vague original question, and would love additional data to help answer this completely.

Silverlight 不支持 FTP 上传本身,但上传文件的概念是通过 HTTP 数据流.

FTP uploading itself is not supported by Silverlight, but the concept of uploading a file is, through an HTTP stream of data.

如果您想从客户端计算机向服务器进行 HTTP 上传:您可以使用 OpenFileDialog 控件 在 Silverlight 2 和 3 中读取该数据,然后使用 WebClient 上传.

If you want to do an HTTP upload from a client machine to the server: You can use the OpenFileDialog control in Silverlight 2 and 3 to read that data, then use WebClient to upload it.

如果您想从 Web 服务器可以发送的内容下载到客户端计算机,那么您需要使用 Silverlight 3 或更新版本,它具有 SaveFileDialog 控件.

If you want to do a download from something your web server can send, to the client machine, then you'd need to use Silverlight 3 or newer, which features a SaveFileDialog control.

所有 Silverlight 文件对话框都需要用户启动的操作才能工作、运行,并且出于安全目的,用户需要选择文件名.

All Silverlight file dialogs require a user-initiated action for them to work, function, and the user will need to select the file name(s) for security purposes.

希望这会有所帮助!

这篇关于Silverlight FTP 上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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