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
Mama's Classroom
NA
11
487
Error When Uploading File: @using Html.BeginForm
May 7 2021 4:22 AM
I tried to upload a file using Html.BeginForm.
But I received an error saying:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /PCController/Progress
PCController is my controller's name. This is from my controller:
[HttpGet]
public
ActionResult Progress()
{
return
View();
}
[HttpPost]
public
ActionResult Progress(HttpPostedFile file)
{
try
{
if
(file.ContentLength > 0)
{
string
_FileName = Path.GetFileName(file.FileName);
string
_path = Path.Combine(Server.MapPath(
"~/Content/PC"
), _FileName);
file.SaveAs(_path);
}
ViewBag.Message =
"File Uploaded Successfully!!"
;
return
View();
}
catch
{
ViewBag.Message =
"File upload failed!!"
;
return
View();
}
}
And this one is for my View:
@
using
(Html.BeginForm(
"Progress"
,
"PCController"
, FormMethod.Post,
new
{ enctype =
"multipart/form-data"
}))
{
<div>
@Html.TextBox(
"file"
,
""
,
new
{ type =
"file"
}) <br />
<input type=
"submit"
value=
"Upload"
/>
@ViewBag.Message
</div>
}
Reply
Answers (
3
)
i just deployed, publishing the API code in prod IIS Server.
issue with bundleconfig file