-1
I am trying to save a file to a folder in my project (In case in Files folder):
but gives the following error when entering the action:
Controller Code:
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Cadastrar(ArquivoPasta oArquivo,HttpPostedFileBase arquivo)
{
FileStream stream = new FileStream(Server.MapPath("Arquivos"+arquivo.FileName), FileMode.Create, FileAccess.Write);
byte[] bytesLogotipo = new byte[arquivo.ContentLength];
arquivo.InputStream.Read(bytesLogotipo, 0, arquivo.ContentLength);
stream.Write(bytesLogotipo, 0, arquivo.ContentLength);
ViewBag.Mensagem = "Arquivo Salvo com sucesso nessa merda!";
return View();
}
I created the folder in the wrong place or the code is wrong?