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
2
votes
3 answers

Send array of files from Jquery ajax to controller action

I am able to pass single file as System.Web.HttpPostedFileBase but when i pass same as array of files i am getting null in controller's action. I've tried sending array of files. HTML:
vinoth kumar
  • 196
  • 2
  • 13
2
votes
1 answer

httppostedfilebase receive null in Web API when requested from Postman

I was trying to send a post request to my API controller. It receives all input except file input. I tried few solutions but nothing is working. I created same form in MVC and it worked but doesn't work in API where am I lacking. My Blogger…
Akash Kool
  • 42
  • 5
2
votes
1 answer

How to pass a file from a form to HttpClient.PostAsync as a MultipartFormDataContent

Have a form that allows users to upload a file. Nothing fancy here. File is catpured as a HttpPostedFileBase by a controller. Then from a controller that HttpPostedFileBase is sent to a service that wants to forward that file to a WEB API using…
2
votes
2 answers

Visual studio is not responding to upload a file of size 6MB

I am working on Visual studio 15. My application needs to upload a file of size 6MB. I am using .Net 4.5.1 with Entity Framework 6. The following script and html code is written at view level razor to select and check uploading of…
2
votes
0 answers

List of multiple files to upload as IEnumerable

I want to upload multiple files in list of dynamic form. My model is like class mymodel { public IEnumerable FileAttachments { get; set; } } public class FileAttachmentViewModel { [DataType(DataType.Upload)] …
Sinte
  • 91
  • 1
  • 8
2
votes
1 answer

How to convert Stream to Byte()

I've been struggling with this for days. I'm trying to create functionality for someone to simply upload an image file from their local machine to an FTP Server using the FileUpload Control. The problem is, the FileUpload control cannot explicitly…
2
votes
0 answers

How to match checkbox ids with files in IEnumerable

I created a model at which user can select checkboxes of states and upload a file for selected states. Since, for each state, there is a upload button created with the (input type="file") property, Html.BeginForm sends all HttpPostedFileBase objects…
user3079364
  • 171
  • 1
  • 15
2
votes
1 answer

Uploading Image in Asp.net mvc Controller

I have a Upload form and I want to pass my information such as an Image and some other field but I don't know how can I upload Image .. This is My model class public partial class NewProductCategory { public string ProductName {…
ILYAS PATEL
  • 268
  • 1
  • 12
2
votes
1 answer

System.IO.Stream in favor of HttpPostedFileBase

I have a site where I allow members to upload photos. In the MVC Controller I take the FormCollection as the parameter to the Action. I then read the first file as type HttpPostedFileBase. I use this to generate thumbnails. This all works fine. In…
Cloud SME
  • 9,854
  • 3
  • 46
  • 85
2
votes
3 answers

How do I unit test a method containing a static method?

Can this be done? Here is the method I'm testing: public void SaveAvatarToFileSystem() { Directory.CreateDirectory(AvatarDirectory); _file.SaveAs(FormattedFileName); } In my unit test, I'm using Rhino.Mocks and I want to verify that…
Lee Warner
  • 2,363
  • 4
  • 27
  • 41
2
votes
2 answers

ASP.NET MVC passing Model *together* with files back to controller

Ok, I've been going at this for several hours and I simply cannot find the solution. I want to get some data from my user. So first, I use a controller to create a view which receives a Model: public ViewResult CreateArticle() { Article…
2
votes
2 answers

How to Post data and one file to action with a ajax requset

i want send a multi parameter with a ajax request . for example : id=1,name="amin",logo:file . id type is int and Name type is String and Logo Type is HttpPostfileBase in my action . var ID = $("#OfficeId").val(); if (ID == "") { var imagefile1…
2
votes
1 answer

how can i save more than one image in the database?

I just want to save the route of the images in the database. So i try this. And i get this error System.NullReferenceException: Object reference not set to an instance of an object. This is my Controller public ActionResult…
Alexis Mateo
  • 47
  • 1
  • 7
2
votes
1 answer

MultipartEntityBuilder HttpPost socket write error in java

I am trying file upload with httpPost request (by MultipartEntityBuilder) in java. But i get a Software caused connection abort: socket write error. Here is my httpPost body (in…
2
votes
0 answers

Required validation in File upload in MVC

I want to make file upload field required, I have done all the other validations on upload ActionResult but the required is not working Here is my code (I want to do all the validation in ActionResult not in Model using [Required]) public…
Rras
  • 153
  • 1
  • 1
  • 9
1 2
3
12 13