TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
selvi jp
NA
323
77.3k
upload image on folder with compressed size web api
May 12 2021 11:41 AM
upload image on folder with compressed size web api.
string sPath = "";
sPath = HostingEnvironment.MapPath("~/Images/");
WebApiDatabaseEntities entities = new WebApiDatabaseEntities();
System.Web.HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files;
// CHECK THE FILE COUNT.
for (int iCnt = 0; iCnt <= hfc.Count - 1; iCnt++)
{
System.Web.HttpPostedFile hpf = hfc[iCnt];
if (hpf.ContentLength > 0)
{
// SAVE THE FILES IN THE FOLDER.
var fileName = Path.GetFileName(hpf.FileName);
var random = Guid.NewGuid() + fileName;
hpf.SaveAs(sPath + Path.GetFileName(random));
iUploadedCnt = iUploadedCnt + 1;
here i am storing image in folder
Reply
Answers (
3
)
Gridview Sorting in C#
How to Exit from Pipeline in Dotnet Core