zip ファイルをアップロードし、ボタンをクリックして同じフォルダーに解凍し、このフォルダーに同じ名前を付ける必要があります。どこから始めればよいかわかりません。アップロードの部分があります: 私の見解:
<% using (Html.BeginForm(null, null, FormMethod.Post, new { enctype = "multipart/form-data" }))
{ %>
<%: Html.ZincValidationSummary() %>
<%: Html.ZincValidationErrors() %>
<div class="section _100">
<%: Html.LabelFor(model => model.Name)%>
<div>
<%: Html.TextBoxFor(model => model.Name, new { maxlength = "100" })%>
<%: Html.ValidationMessageFor(model => model.Name)%>
</div>
</div>
<div class="section _100">
<%: Html.LabelFor(model => model.ScormPackageFile) %>
<div>
<br />
<input type="file" id="ScormPackageFile" name="ScormPackageFile" />
<%: Html.ValidationMessageFor(model => model.ScormPackageFile)%>
<br />
</div>
</div>
<div class="actions">
<div class="actions-right">
<input type="submit" value="<%: Html.Resource(Resources.Global.Button.Save) %>" class="submit_button" />
</div>
</div>
<% } %>
コントローラーで:これは私が何をすべきか分からないところです:
HttpPost]
public ActionResult Upload(ScormUploadViewModel model)
{
if (ModelState.IsValid)
{
if (model.ScormPackageFile != null)
{
string extractDir = "c:\\TSFPreview\\Zinc\\Web\\Project\\ScormPackages";
//I should get the above dir from the uploaded file's directory because the
unziped folder will be in the same folder
}
var smallImageUrl = MediaStorageService.UploadFromStream(Zinc.Media.MediaType.Attribute, model.ScormPackageFile.FileName, model.ScormPackageFile.ContentType, model.ScormPackageFile.InputStream);
//group.SmallImageUrl = smallImageUrl;
}
return View(model);
}
それから私のビューモデル:
public class ScormUploadViewModel
{
[LocalizedRequired]
[DataType(DataType.Text)]
[LocalizedDisplayName(Resources.Global.Title.Name)]
public string Name { get; set; }
[DisplayName("Upload a scorm package")]
public HttpPostedFileBase ScormPackageFile { get; set; }
}
おかげで、他にどのタグを追加する必要があるのか わかりません。今のところ、asp.net mvc 3タグを追加しました:)