我有一种看法模式,以使用上载。 我需要将后继数据收集数据退回员额。 我如何能够这样做?
观点:
public class ViewModel
{
string Name;
IEnumerable<Junk> theJunk;
}
public Junk
{
int id;
string Name;
}
观点:
@model ViewModel
@using (@Html.BeginForm())
{
<input type="file" name="dr405" id="dr405" />
<div>
@Html.LabelFor(model => model.Name)
@Html.EditorFor(model => model.Name)
</div>
@Html.EditorFor(model => model.theJunk)
<input type="submit" value="Upload Junk" />
}
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function () {
jQuery("#dr405").uploadify({
uploader : @Url.Content("~/Scripts/uploadify.swf") ,
cancelImg : /Content/themes/base/images/cancel.png ,
buttonText : Browse Files ,
script : home/upload ,
folder : /uploads ,
fileDesc : Image Files ,
fileExt : *.jpg;*.jpeg;*.gif;*.png ,
sizeLimit : 38000 ,
multi : true,
auto : true,
});
});
</script>
主计长:
[HttpPost]
public ActionResult Upload(HttpPostedFileBase fileData, FormCollection collection)
{
// Get my view model here
// ...get the main Name!
// ...get the collection of Junk
return "ok";
}