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 5954385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:57:49+00:00 2026-05-22T17:57:49+00:00

If I use this as my Controller Action…FAIL. [HttpPost] public ActionResult Index(HttpPostedFileBase FileData) {

  • 0

If I use this as my Controller Action…FAIL.

    [HttpPost]
    public ActionResult Index(HttpPostedFileBase FileData)
    {
        var saveLocation = Path.Combine(Server.MapPath("\\"),"returns");
        System.IO.Directory.CreateDirectory(saveLocation);
        FileData.SaveAs(Path.Combine(saveLocation, FileData.FileName));
        ViewBag.Message = String.Format("File name: {0}, {1}Kb Uploaded Successfully.", FileData.FileName, (int)FileData.ContentLength / 1024); 
        return View();
    }

When I run my web app and try to upload a file I get a progress bar that works, gets to a random percentage, then returns a generic error.

enter image description here

However!!

This Controller Action works perfect.

         [HttpPost]
         public String Upload(HttpPostedFileBase FileData)
         {
             var saveLocation = Path.Combine(Server.MapPath("\\"),"returns");
             System.IO.Directory.CreateDirectory(saveLocation);
             FileData.SaveAs(Path.Combine(saveLocation,FileData.FileName));
             ViewBag.Message = String.Format("File name: {0}, {1}Kb Uploaded Successfully.", FileData.FileName, (int)FileData.ContentLength / 1024);
             return ViewBag.Message; 
         }

Here is the code from my upload page. All the script references are loaded in site.master.

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>



<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%: ViewBag.Message %></h2>
    <%= this.Profile.TaxPayerID  %>
    <p>Please upload your return</p>   
<script type="text/javascript">
    $(document).ready(
    function () {
        $("#fileuploader").fileUpload({
            'uploader': '/Scripts/uploader.swf',
            'cancelImg': '/Images/cancel.png',
            'buttonText': 'Select DR405',
            'script': 'Home/Upload',
            'folder': '/returns',
            'fileDesc': 'Image Files',
            'fileExt': '*.csv;*.txt;*.xls;*.xlsx',
            'auto': true
        });
    }
);
    </script>

<div id="fileuploader"></div>
</asp:Content>

Why can’t I return ActionResult?

  • 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-22T17:57:49+00:00Added an answer on May 22, 2026 at 5:57 pm

    Noticing a few things here. Not sure why your MVC3 app has asp tags and a page declaration header. The uploadify requires an input tage type=”file” with a unique ID on the page, but your example points to a div tag. Try changing that to a <input type="file"/> tag.

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

Sidebar

Related Questions

If we use this standard route: routes.MapRoute( Default, // Route name {controller}/{action}/{id}, // URL
In ASP.NET MVC, we're required to use the suffix Controller for all controllers. This
I am trying to use this UrlHelper extension method: public static string ToPublicUrl(this UrlHelper
I have a resource 'User'. In it's controller there is an action 'choose'. Index
I want to use a URL rewrite on my site: /:@controller/:@action/ So I want
Given this UrlMapping: /foo/$foobar { controller = foo action = foo constraints { }
my routes.rb looks like this map.resources :bookmarks map.connect ':controller/:id/:action' map.connect ':controller/:action' so i can
If I set this in my environment config.action_controller.cache_store = :mem_cache_store ActionController::Base.cache_store will use a
This may not be the correct way to use controllers, but I did notice
use this website a lot but first time posting. My program creates a number

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.