2013-07-10 40 views
0

我在POST表單中添加了一個額外的「title」字段,並在我的模型中創建了「title」屬性。視頻上傳完成後,服務器將轉到另一個控制器。這是通過在策略文件中設置重定向字段來完成的。現在我怎樣才能訪問重定向控制器中的標題字段?AmazonS3中的額外輸入字段直接上傳POST表單

的POST形式:

<form action="@Model.FileUploadModel.FormAction" method="@Model.FileUploadModel.FormMethod" enctype="@Model.FileUploadModel.FormEnclosureType" > 

        <input type="hidden" name="key" value="@Model.FileUploadModel.FileId" /> 
        <input type="hidden" name="AWSAccessKeyId" value="@Model.FileUploadModel.AWSAccessKey" /> 
        <input type="hidden" name="acl" value="@Model.FileUploadModel.Acl" /> 
        <input type="hidden" name="policy" value="@Model.FileUploadModel.Base64EncodedPolicy" /> 
        <input type="hidden" name="signature" value="@Model.FileUploadModel.Signature" /> 
        <input type="hidden" name="redirect" value="@Model.FileUploadModel.RedirectUrl" /> 
        <div class="row"> 
          **<label for="Title" style="padding-right: 5px;">Title (optional) </label> 
          <input type="text" name="Title" style="width: 200px;" />** 
        </div> 
        <div class="row_clear"></div> 
        <div class="row"> 
          <input type="file" name="file" size="100" id="file"/> 
        </div> 
       </form> 

和我FileUploadModel

public FileUploadModel(string publicKey, string privateKey, string bucketName, string redirectUrl) 
    { 
     myPrivateKey = privateKey; 

     FormAction = string.Format("https://{0}.s3.amazonaws.com/", bucketName); 
     FormMethod = "post"; 
     FormEnclosureType = "multipart/form-data"; 
     Bucket = bucketName; 
     FileId = "u5/i/" + Guid.NewGuid().ToString(); 
     AWSAccessKey = publicKey; 
     Acl = "private"; 

     RedirectUrl = redirectUrl; 
    } 
    public string FormAction { get; private set; } 
    public string FormMethod { get; private set; } 
    public string FormEnclosureType { get; private set; } 
    public string Bucket { get; private set; } 
    public string Acl { get; private set; } 
    public string Policy { get; private set; } 
    public string FileId { get; private set; } 
    public string AWSAccessKey { get; private set; } 
    public string RedirectUrl { get; private set; } 
    [Display(Name = "Title (optional)")] 
    public string Title { get; set; } 
    [Display(Name = "File")] 
    public HttpPostedFileBase File { get; set; } 
    public int? Page { get; set; } 
    public string SearchString { get; set; } 

} 

}

這裏是我提到的創建策略形式的鏈接。

Link

回答

0

我工作圍繞這一問題通過此網址發送title屬性。

在我RouteConfig文件我增加了一個新的途徑:

routes.MapRoute(
       name: "Transcode", 
       url: "{controller}/{action}/{title}/{id}", 
       defaults: new 
       { 
        controller = "Videos", 
        action = "Transcode", 
        id = UrlParameter.Optional 
       } 
      ); 

,然後在轉碼操作我加了一個標題參數。最後,我傳遞給重定向URL屬性的值爲:「http://dev.area.local/Videos/Transcode/title

相關問題