Silverlight上载文件,返回文件已上载的路径. [英] Silverlight Uploading files, returning the path where file has been uploaded.

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

问题描述

我在Silverlight中有一个RIA,可以让您上传图像.

I have a RIA in silverlight which allows you to upload an image.

Uri u = new Uri(PhotoAlbum.App.Current.Host.Source, "/upload.ashx/?filename=" + fileName);
WebClient c = new WebClient();



因此,实际上传可以正常进行.但是我想不出一种方法来检索它已被上传到哪里.我使用固定的上传路径. /x/日期/名称

虽然如果该名称已经存在于地图中,但我将其重命名(根据当前名称长度的随机字符)

尽管如果上传完成,我将无法找到一种方法来检索图像链接"(就像在某种程度上,我不知道如何使upload.ashx返回或将某些内容发送回RIA,因为它可能不可能吗?).

现在已经停滞了几天...真的可以使用一些帮助.我需要一种方法来告诉RIA文件,以便它可以弹出带有链接的子窗口.

非常感谢您的帮助..



So the actual uploading goes fine. But I can''t figure out a way to retrieve where it has been uploaded. I use a fixed upload path. /x/date/name

Though if the name already exists in the map, I rename it(Random chars based on current names length)

Though if uploading is finished I can''t find a way to retrieve the "image link" (Like in a way, I do not know how I can make the upload.ashx return or send something back to the RIA, as it probably is impossible?).

Have been stuck for a few days now... Could really use some help. I need a way of telling my RIA the files, so it can popup a child window with the links to them.

Help is much appreciated..

推荐答案

在开始之前,我要说我不是RIA用户.

网页(从客户端的角度来看,这是ASHX解析的)具有内容.在该内容中,您可以放置​​客户端(RIA)需要解析的任何内容.您的ASHX代码可以访问上下文.响应,您可以在其中放置实际的文件名.

RIA似乎处理WCF Web服务,所以我想您是在RIA服务调用之外调用upload.ashx? (也许您可以添加实际调用上传器的代码?)因此,在Silverlight客户端上用于上传的响应处理程序中,检查响应中是否存在从ASHX放入的信息.

如果您将其作为Web服务调用,则需要将信息包装在XML包中.
Before starting let me say I am not an RIA user.

A web page (which is what an ASHX resolves to from the client point of view) has content. In that content you can put whatever you like, which the client (RIA) needs to parse. Your ASHX code has access to context.Response and in there you can put the actual file name.

RIA seems to deal with WCF web services so I guess you are calling upload.ashx outside the RIA service calls? (Perhaps you could add the code that actually calls the uploader?) So in the response handler on the Silverlight client side for the upload, check the response for the information you put in there from the ASHX.

If you are calling it as a web service you will need to wrap the information up in an XML package.


对不起,这的确是答案……看不到如何我错过了这一点,只需制作一个HttpResponse并写下您想要的内容,我就能得到所需的物品!

因此,如果有人有类似的问题,请使用HttpResponse发送响应并从发送方读取它!
感谢您的帮助!
Sorry yes, this is indeed the answer... Can''t see how i''ve missed that, by simply making a HttpResponse and writing what u want back I got the needed items!

So if anyone has a similiar question send a response with HttpResponse and read it from the sender!
Thanks for the help!


这篇关于Silverlight上载文件,返回文件已上载的路径.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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