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
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
  • 247
  • 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,745
  • 5
  • 34
  • 61
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,975
  • 14
  • 44
  • 83
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
0
votes
1 answer

Using Moq with HttpPostedFileBase and one other parameter

I have a method that takes 2 parameters like: assetService(assetDto dto, HttpPostedFileBase photo) and i can't use moq with this. How can i do that? (using 'moq') public ResultObjectDto CreateAsset(AssetDto model, HttpPostedFileBase file) and i…
0
votes
0 answers

C# HttpPostedFileBase.ContentType fails one string comparison, passes another

I'm trying to compare the content type of an HttpPostedFileBase against an array of acceptable types, and I'm encountering some genuinely odd behaviour. array.Contains() can't find the string, but if I iterate over the collection and compare each…
roryok
  • 9,325
  • 17
  • 71
  • 138
0
votes
0 answers

On [HttpPost] Create in MVC4, need to upload a large file that will get saved to a file share in conjunction with inserting a record into SQL

I have a basic form on my Create page in my ASP.NET MVC application. The fields are strongly typed to my model. So, whenever I submit the form, a single record gets inserted into my SQL database. This is fine. The obstacle I'm encountering is I…
Mike Marks
  • 10,017
  • 17
  • 69
  • 128
0
votes
1 answer

HttpFilePostedBase parameter is null

I have the following pieces of code in my MVC 3 app: View: @(Html.Telerik().Upload() .Name("insertAttachement") .Multiple(false) .Async(async => async.Save("InsertUpload", "DocumentMaquette")) .Localizable("fr-CH") …
Silviu Preda
  • 628
  • 1
  • 10
  • 31
0
votes
1 answer

HttpPostedFileBase in ASP.NET MVC is null while using jQuery Dialog

File upload paths in MVC is null with jquery dialog I have created a MVC application having two file uploads in view and created a POST action for this, with IEnumerable parameter to catch the files. When i am submitting the form the files are…
0
votes
2 answers

HttpPostedFileBase always returns null

I am using MVC 4 and I tried for upload file concept. Here is my code:
@Html.Label("Upload the file")
user2291535
0
votes
1 answer

Linq over InputStream from HttpPostedFileWrapper

Is it possible to apply a Linq query from a HttpPostedFileWrapper? My web app allows users to select a bunch of .csv files. I now need to open those files and import them. My previous code, which uses paths and file names looks like; …
griegs
  • 22,624
  • 33
  • 128
  • 205
0
votes
1 answer

C#: Initialize HttpPostedFileBase from a file path (string)

I have a path (stored as a string) - eg \\documents\doc1.txt. I am trying to initialize a variable of type HttpPostedFileBase with the file represented by the string path. How can I do that please? I have looked at method like Model.File[count] =…
jpo
  • 3,959
  • 20
  • 59
  • 102
0
votes
2 answers

HttpPostedFileBase with PartialView

I have a main view which contains a partial view. The model of partial view has 1 property called "HttpPostedFileBase file", together with other properties However when the main-view get posted, all the other properties in that model get correct…
Samuel
  • 631
  • 1
  • 10
  • 26
0
votes
1 answer

mvc3 get full path using HttpPostedFileBase

I have a browse button and I am saving it to the database. using mvc3 view @using (Html.BeginForm("Upload", "Upload", FormMethod.Post, new { enctype = multipart/form-data" })) { } control public ActionResult…
Benk
  • 1,284
  • 6
  • 33
  • 64
1 2 3
12
13