- BugFix #15046: XmlRpc integration for the media module...

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042134
This commit is contained in:
suhacan
2009-11-25 02:09:52 +00:00
parent 5fc4f9b4bd
commit b1e987e3c5

View File

@@ -55,13 +55,13 @@ namespace Orchard.Media.Services {
var name = file.Optional<string>("name");
var bits = file.Optional<byte[]>("bits");
var target = HttpContext.Current.Server.MapPath("~/Files/" + name);
var target = HttpContext.Current.Server.MapPath("~/Media/" + name);
Directory.CreateDirectory(Path.GetDirectoryName(target));
using (var stream = new FileStream(target, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) {
stream.Write(bits, 0, bits.Length);
}
uriBuilder.Path = uriBuilder.Path.TrimEnd('/') + "/Files/" + name.TrimStart('/');
uriBuilder.Path = uriBuilder.Path.TrimEnd('/') + "/Media/" + name.TrimStart('/');
return new XRpcStruct().Set("url", uriBuilder.Uri.AbsoluteUri);
}