【发布时间】:2014-01-23 20:23:02
【问题描述】:
我是 Web 开发的新手,但我的概念很混乱所以我有 2 个问题
1->我的 PDF 链接 URL“https://hrbcdev.blob.core.windows.net/uploads/UserForms/reportlayout-130334646861135641.pdf”和任何普通的 PDF Google 链接“http://www.syncfusion.com/Content/downloads/ebook/Knockoutjs_Succinctly.pdf”有什么区别,因为我的链接下载 PDF,而另一个链接在浏览器中打开。
2-> 我正在使用 Windows Azure Blob 将 PDF 文件上传到服务器,但是当我单击这些文件时,它会自动开始下载。但我想在新选项卡中打开而不是下载它......在文件上传期间是否有任何属性告诉服务器文件是否可下载。这是我的代码:
[HttpPost]
public virtual ActionResult UploadFile(string kind, int? entityId = null) // optionally receive values specified with Html helper
{
// here we can send in some extra info to be included with the delete url
var statuses = new List<ViewDataUploadFileResult>();
var thumbnailKind = AppConfig.KnownKind(kind);
var uploadLocation = AppConfig.UploadLocation(thumbnailKind);
for (var i = 0; i < Request.Files.Count; i++)
{
var storage = new AzureFileStorage();
var st = storage.StoreFile(x =>
{
x.File = Request.Files[i];
x.Kind = thumbnailKind;
//note how we are adding an additional value to be posted with delete request
//and giving it the same value posted with upload
x.DeleteUrl = Url.Action(MVC.FileUploader.DeleteFile(entityId));
x.StorageDirectory = uploadLocation.Path;
x.UrlPrefix = uploadLocation.Url;
});
statuses.Add(st);
}
var json = new { files = statuses };
return Request.Headers["ACCEPT"].Contains("application/json")
? Json(json)
: (ActionResult)Content(json.ToJson());
}
【问题讨论】:
标签: c# .net pdf azure knockout.js