Questions tagged [httppostedfilebase]

A class type in .NET used to assist with file uploads.

HttpPostedFileBase is a .NET class designed to make file uploads in ASP.NET projects easier.

MSDN Documentation

183 questions
0
votes
0 answers

Pass javascript object with HttpPostedFileBase field to MVC controller

I need to pass object from javascript to MVC controller. I do this in this way: $.ajax({ type: 'POST', url: '/Companies/Edit/', dataType: 'json', data: { Id: id, Name: name, Adress:…
1_bug
  • 4,454
  • 3
  • 39
  • 49
0
votes
0 answers

Multiple files with same name all dissapear when one is empty

I am using .net mvc and are uploading files to public IEnumerable SubmissionUploadFiles { get; set; } .net mvc puts the files nicely into that variable and it works with both one and multiple files. But here is the odd thing,…
Rickard Liljeberg
  • 826
  • 1
  • 11
  • 35
0
votes
0 answers

asp.net mvc 4 httppostedfilebase not passing to controller when using ajax modal popup

There are some similar topics in forums, but there isn't any good answer. First question is that is it possible to pass httppostedfilebase to controller, when using modal popup? When I am using regular model and view, then everything is working…
0
votes
0 answers

mvc 4 web api : partial model is being recieved

I have a method in web api which i call from the view: Web api code: public CarProperties Post(CarProperties car) { if(car.file!=null) { var path = Path.Combine(Server.MapPath("~/Images/"), Path.GetFileName(car.file.FileName)); …
Nikitesh
  • 1,239
  • 1
  • 16
  • 34
0
votes
2 answers

HttpPostedFileBase is always empty

I am trying to upload image files from my form along with other fields in my model. My HttpPostedFileBase collection is always empty and the count is 0. I have referred many other questions relating to this in SO but somehow I am unable to find the…
Prady
  • 9,658
  • 38
  • 120
  • 170
0
votes
1 answer

Full path of the file from the remote server

I am working with files and I don't really understand how to make it work. I have a web application (c#) that is located on the server and users use this application to upload some information from the files. The problem that I am having that users…
MarinaS
  • 13
  • 6
0
votes
1 answer

Custom validation of HttpPostedFileBase

I use MVC5. I've got some issue with file uploading using HttpPostedFileBase. I've got a form where I can can choose a file from my disk and type some information about it(in textbox). When I submit a form the controller action is called. In this…
WaltLift0
  • 43
  • 1
  • 5
0
votes
1 answer

MVC edit with an HttpPostedFileBase

I have been mostly following this tutorial: http://cpratt.co/file-uploads-in-asp-net-mvc-with-view-models/ It created a good create view that allows the user to upload an image. How would I create a similar page that displays the current image file…
NerdyFool
  • 511
  • 6
  • 12
0
votes
0 answers

How to update a model which contains uploaded file in .NET MVC?

I have a classified ad View Model that is defined as: public class ClassifiedAd { public int ClassifiedAdId { get; set; } public string Title { get; set; } public string Text { get; set; } public HttpPostedFileBase ImageFile { get; set;…
Marko
  • 11,003
  • 8
  • 43
  • 55
0
votes
1 answer

File Upload: Fail to assign value into File, keep poping null to me? Need help, any pro?

I'm doing an upload in asp mvc, it is working great at first user attemp to attach a file into model, file is system.web.httpfilewrapper . But when it comes to second attemp where controller catching an invalid amount from other textbox, and it…
0
votes
1 answer

Error Occurs When Store File into Database

An error occurs When I try To upload File The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. My Assignment DB attribute >>…
WeakTaenie
  • 227
  • 2
  • 6
  • 14
0
votes
2 answers

ASP.NET MVC 4 C# HttpPostedFileBase, EntityValidationErrors Save into DB

In my database My FileLocation is VarChar(Max) I not sure what caused this EntityValidationErrors -System.Data.Entity.Validation.DbEntityValidationException: Validation failed for one or more entities. This error occurs when db.SaveChanges()…
0
votes
1 answer

Variable number of HttpPostedFileBase objects

Currently, I have this: public ActionResult Add(FormCollection form, HttpPostedFileBase fr, HttpPostedFileBase en, HttpPostedFileBase es) { Upload(fr, "fr"); Upload(en, "en"); Upload(es, "es"); ... } This works for what we're doing…
Robert
  • 1,617
  • 4
  • 32
  • 59
0
votes
1 answer

HttpPostedFileBase : Embedded statement cannot be a declaration or labeled statement

Using ASP .Net MVC 4 Razor. On my view page, I have HTML
I am using following scripts:
Abdur Rahim
  • 3,599
  • 11
  • 42
  • 77
0
votes
2 answers

ASP.Net MVC image upload failing in Google Chrome

I have an image upload form <% using (Html.BeginForm("PictureValidateAndSave", "UserGallery", new {}, FormMethod.Post, new { enctype = "multipart/form-data"})) { %>
Album Name: <%=…
godhandiscen
  • 85
  • 2
  • 6