Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 791065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:46:34+00:00 2026-05-14T21:46:34+00:00

I am trying to upload images via a form which sits in partial view

  • 0

I am trying to upload images via a form which sits in partial view using MVC.

View Code:

<form action="/Item/ImageUpload" method="post" enctype="multipart/form-data">
   <%= Html.TextBox("ItemId",Model.ItemId) %>
   <input type="file" name="file" id="file"  />
   <input type="submit" value="Add" />
</form>

Action Code:

public void ImageUpload(string ItemId, HttpPostedFileBase file)
{
// upload image
// Add Image record to database
// Associate Image record to Item record
//Go back to existing view where the partial view sits
RedirectToAction("Details/"+ItemId);
}

The Image is uploaded successful

All the data manipulation are working as expected

However instead of redirect to view “Item/Details/id”, page went to “/Item/ImageUpload”

I tried several different way of doing this including using jsonResultAction, but all failed in this same result.

where did i do wrong, any ideas? thanks in advance

Edit:

I just realized all the routing which are render by the code is not working.

for example: [ <%= Html.ActionLink("Log Off", "LogOff", "Account") %> ]
instead of rendering <a href="/Account/LogOff">Home</a> it renders <a href="">Home</a>

however all the routings which were hard coded are all working.

Where did i break it?? It troubles that I cant event restore it.

Code for Global.asax.cs

public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");


            //routes.MapRoute(
            //   "ImageResize",
            //   "{controller}/{action}/{id}/{value}",
            //   new { controller = "Image", action = "ShowImage", id = "", value = "" }); 

            routes.MapRoute(
                "Default",                                              // Route name
                "{controller}/{action}/{id}/",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );


        }

        protected void Application_Start()
        {
            RegisterRoutes(RouteTable.Routes);
        }


    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T21:46:35+00:00Added an answer on May 14, 2026 at 9:46 pm

    I think you need to use return RedirectToAction("Deati....

    If you already have the keyword return there then add that to your question and I’ll remove this answer

    EDIT

    In that case I’d write a route which allows you to then say something like return RedirectToRoute("name", model);

    EDIT 2

    All I can offer at this point I think is from the account controller that’s auto generated.

    public ActionResult LogOff()
    {
    
        FormsAuth.SignOut();
    
        return RedirectToAction("Index", "Home");
    }
    

    Looking at the code you have presented I see public void ImageUpload rather than public ActionResult ImageUpload.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload multiple images using meioupload which works fine if I
I am trying to upload a file via a form and then save in
I am trying to upload images to yFrog which is working just fine, but
I am trying to upload images using a webservice from silverlight. I am first
Hi I wanted to upload images(along with other form details) and preview them, using
I'm trying to upload images using Graph API Batch Request, but i'm unable to
I'm trying to upload multiple files via a form, but I can only upload
I'm trying to upload an image via the Django admin and then view that
I am trying to upload images to ImageShack using the API. I think they
I'm trying to urlencode a png for upload using the Tumblr API via iOS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.