Posts

Showing posts with the label File upload in C#

Document Upload in Azure Cloud with ASP.Net MVC

Configure Azure storage connection string To configure your connection string, open the web .config or app.config file from Solution Explorer in Visual Studio.Add below line in <appSettings> tag of your config file. Replace "your account name" with the name of your storage account, and "your account key" with your account access key: < add key = " StorageConnectionString " value = " DefaultEndpointsProtocol=https;AccountName=<your account name>;AccountKey=<your account key> " /> Parse the connection string from Config file The Microsoft Azure Configuration Manager Library for .NET provides a class for parsing a connection string from a configuration file. below is example that shows to retrieve a connection string from a configuration file: CloudStorageAccount storageAccount = CloudStorageAccount .Parse( CloudConfigurationManager .GetSetting( "StorageConnectionString" )); Above line w...

File Upload uisng Jquery in C# ASP.Net MVC

There so many ways to upload files with jqueries in ASP.Net C#. One way is with creating XMLHttpRequest and another way is with FormData object. In this post i'll show uploading files and saving form data in one ajax call using jquery. Upload Files with Jquery in ASP.Net MVC C# First code for View which represents normal html code of form @model modelname File Upload File @Html.TextBoxFor(m => m.File, new { @type = "file", @multiple = "multiple" }) Field 1 @Html.TextBoxFor(m => m.Field1, new { @class = "form-control datepicker" }) @Html.ValidationMessageFor(m => m.Field1) Submit MVC Controller Code for Saving File In controller create action method with two arguments one is for formdata and another one is for List of HttpPostedFileBase Class which represents multiple files that you select. public JsonResult SaveFilesWithFormData(ModelName FormData, List Of HTTPPostedFileBase Files) //Model Name rep...