Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mt = db.MtoTransparencia.Find(id);
- if (mt == null)
- {
- return HttpNotFound();
- }
- var adjunto = new MtoTransparenciaAdjunto
- {
- MtoTransparenciaId = mt.MtoTransparenciaId,
- };
- return View(adjunto);
- @model WebDBT.Models.MtoTransparenciaAdjunto
- @{
- Layout = null;
- }
- @using (@Html.BeginForm("UploadAdjunto", "MtoTransparencia", FormMethod.Post, new { @class = ".FrmUpload" }))
- {
- @Html.AntiForgeryToken();
- @Html.HiddenFor(model => model.MtoTransparenciaId);
- <div class="form-horizontal">
- <hr />
- @Html.ValidationSummary(true, "", new { @class = "text-danger" })
- <div class="form-group">
- @Html.LabelFor(model => model.Ruta, htmlAttributes: new { @class = "control-label col-md-2" })
- <div class="col-md-10">
- @Html.TextBoxFor(model => model.Ruta, "", new { @type = "file", @multiple = "multiple", @name = "file" })
- @Html.ValidationMessageFor(model => model.Ruta, "", new { @class = "text-danger" })
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10">
- <input type="submit" value="Upload" class="btn btn-primary" />
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-2 col-md-10 text-success">
- @ViewBag.FileStatus
- </div>
- </div>
- </div>
- @section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
- @Scripts.Render("~/bundles/WEBDBT")
- @Scripts.Render("~/Scripts/WebScript/MtoTransparencia.js")
- }
- [ValidateAntiForgeryToken, HttpPost]
- public ActionResult UploadAdjunto(HttpPostedFileBase File,MtoTransparenciaAdjunto model)
- {
- var user = db.MtoUsuarios.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();
- if (user == null)
- {
- RedirectToAction("Index", "Home");
- }
- File = File ?? Request.Files["Ruta"];
- if (File.ContentLength != 0)
- {
- string extension = System.IO.Path.GetExtension(File.FileName).ToLower();
- string[] validFileTypes = { ".xls", ".xlsx", ".csv" };
- }
- return View();
- }
- File = File ?? Request.Files["Ruta"];
- System.NullReferenceException: 'Referencia a objeto no establecida como instancia de un objeto.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement