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

188 questions
0
votes
2 answers

HttpPostedFileBase always return null ASP.NET MVC 5

I have a problem when i try to upload a file in ASP.NET MVC5. Somehow "HttpPostedFileBase file" always returns null, i can't find my problem. My Code: (Controller) public ActionResult Edit(PMNieuwePloeg ploeg, FormCollection frm, HttpPostedFileBase…
Robki
  • 3
  • 4
0
votes
2 answers

image corrupted while FTP upload using C#

im trying to upload jpeg to ftp server using C#. the file is uploaded but it is corrupted while opening it. this is my code: /// /// Upload HttpPostedFileBase to ftp server /// /// type of…
Basilf
  • 401
  • 5
  • 17
0
votes
1 answer

Should I convert image into HttpPostedFileBase?

I need to post a form. One of the properties of my model is an image. To do so I am using in fact 2 properties: Logo is a Byte[] and is used to show the image in display mode. LogoForPost is a HttpPostedFileBase and is used to upload image in edit…
Luis Gouveia
  • 8,334
  • 9
  • 46
  • 68
0
votes
1 answer

MVC: using HttpPostedFileBase returns NULL

I am trying to include file upload by it remains NULL all the time. Here is my Model: [Display(Name = "Upload Document")] [DataType(DataType.Upload), FileSize(102400)] public HttpPostedFileBase PathwaysToImpactUploadDocument { get; set;…
JADE
  • 475
  • 4
  • 12
  • 24
0
votes
1 answer

HttpPostedFileBase File because it is being used by another process

i have use a controller action with use of file uploader and i want to compress the image and compress process perform after save the image, so my problem is : i want save only compress image and delete the orignal one. but this code shows error :…
sandeep singh
  • 143
  • 1
  • 13
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
  • 5,505
  • 4
  • 50
  • 58
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
  • 966
  • 1
  • 12
  • 39
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,287
  • 1
  • 17
  • 38
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
  • 10,978
  • 39
  • 124
  • 176
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
  • 1
  • 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
  • 531
  • 1
  • 7
  • 14
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
  • 12,543
  • 10
  • 48
  • 58
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…