I'm using the new KendoUI Extensions for MVC and while they work I'm having this weird issue where the Upload component seems to be just returning the filename of the file and not the full path.
Does anyone know why? This has never happened before, so I'm a little confused as to why it's happening now.
The "hpf.FileName" is the filename only and not the full path to the file.
Thanks,
King Wilder
Does anyone know why? This has never happened before, so I'm a little confused as to why it's happening now.
[HttpPost]public virtual ActionResult CreateTable(IEnumerable<HttpPostedFileBase> files){ string tableName = Request["CreateTableViewModel.TableName"].ToString(); bool blnOk = true; try { if (string.IsNullOrEmpty(tableName)) { ModelState.AddModelError("CreateTableViewModel.TableName", "Table Name is required."); blnOk = false; } if (files == null) { ModelState.AddModelError("files", "CSV file is required"); blnOk = false; } if (!blnOk) { return RedirectToAction(MVC.Data.CreateTable()); } foreach (var hpf in files) { if (hpf.ContentLength == 0) { ModelState.AddModelError("files", "You must select a file to upload."); return RedirectToAction(MVC.Data.CreateTable()); } _sqlService.CreateDatasource(hpf.FileName, tableName); } return RedirectToAction(MVC.Data.Success()); } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return RedirectToAction(MVC.Data.CreateTable()); }}The "hpf.FileName" is the filename only and not the full path to the file.
Thanks,
King Wilder