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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:48:45+00:00 2026-06-16T21:48:45+00:00

For now I am able to upload the file successfully… What I’m trying to

  • 0

For now I am able to upload the file successfully… What I’m trying to do right now is show an alert box if the file was successfully uploaded or show an alert for the error/exception if not…

Here is my view:

using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { @id = "File", enctype = "multipart/form-data"}))
        {
        <div class="control-group">                
            <input type="file" id="file" name="file" />
            <input type="submit" value="Upload" />
        </div>
        }

Here is my controller:

[HttpPost]   
public ActionResult Upload(HttpPostedFileBase file)
{
    try
    {
        //some code here for the upload....             

        /*In this part is my problem...Both Lines below is not showing the alert...*/
        //return new JavaScriptResult() { Script = "alert('The calendar XML file was uploaded successfully!');" };
        //return JavaScript("alert('The calendar XML file was uploaded successfully!');");
    }

    catch (Exception e)
    {   
        log.Error("HomeController::Upload()", e);
        return new JavaScriptResult() { Script = "alert(\"" + e.Message + "\");" };
    }
}

What i would like is that my view would still remain… no redirection of page… just merely showing of that alert box for the message…Thank you! Any ideas is greatly appreciated coz i know this way of mine is not recommended… 🙂

  • 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-06-16T21:48:47+00:00Added an answer on June 16, 2026 at 9:48 pm

    I was able to find the right solution here.

    The link above was for showing a confirmation box before submitting the form and showing an alert for the message that was a json object returned by my controller…

    return Json(new { isok = true, message = "Successfully uploaded the calendar XML file!" }, "application/octet-stream");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to generate a link using my file upload system, now after
I am lost right now with trying to upload an image to my server.
I am able to upload a single file and now how do I upload
I have put my tns connection into the .ora file and am now able
I am reading .csv file through PHP using fgetcsv(). Now I am able to
I am able to successfully call a function with ctypes in Python. I now
I'm trying to create a custom file upload control in WPF 4.0 and I'm
I'm implementing some file upload feature through ajax request. I'd like to be able
I am trying to create an upload page where I upload a .swf file
I have successfully been able to upload files from Android to my server. I

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.