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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:55:30+00:00 2026-05-23T17:55:30+00:00

I am using jQuery.Form to upload files on server. Here is an sample I

  • 0

I am using jQuery.Form to upload files on server.
Here is an sample I am using http://aspzone.com/tech/jquery-file-upload-in-asp-net-mvc-without-using-flash/

I wan to to validate file on server for NULL and for extension,

public FileUploadJsonResult UploadSubscriptions(HttpPostedFileBase file)
        {
            if (file == null)
                return new FileUploadJsonResult { Data = new { message = string.Format(" Error uploading file. Choose the file") } }; 

            if(Path.GetExtension(file.FileName).ToLower() != "csv")
                return new FileUploadJsonResult { Data = new { message = string.Format("{0} Error uploading file. Invalid extension.", System.IO.Path.GetFileName(file.FileName)) } }; 

            //Doing the thing here...

            return new FileUploadJsonResult { Data = new { message = string.Format("{0} uploaded successfully.", System.IO.Path.GetFileName(file.FileName)) } }; 
        }

but in all of the cases if i will return FileUploadJsonResult on client it will be successful result, function success will be executed:

success: function (result) {
                //debugger;
                $("#ajaxUploadForm").unblock();
                $("#ajaxUploadForm").resetForm();
                $.growlUI(null, result.message);
            },
            error: function (xhr, textStatus, errorThrown) {
                $("#ajaxUploadForm").unblock();
                $("#ajaxUploadForm").resetForm();
                $.growlUI(null, 'Error uploading file. Try again later');

                $('div.growlUI').css("background", "url(attention48.png) no-repeat 10px 10px");
            }

In such case i may edit the function ‘success’ to put conditions to check result.message and then display growlUI with error, but i would rather generate error on server to execute client function error
How can i do that?

UPDATE:

here is my ‘success’ funciton modification to handle errors:

success: function (result) {
                //debugger;
                $("#ajaxUploadForm").unblock();
                $("#ajaxUploadForm").resetForm();

                $.growlUI(null, result.message);

                if (result.message.indexOf("Error") != -1)
                    $('div.growlUI').css("background", "url(attention48.png) no-repeat 10px 10px");
            },
  • 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-23T17:55:30+00:00Added an answer on May 23, 2026 at 5:55 pm

    Success and error refer to the call you make to the server. An error is if the addres is unreachable or there are connection problems, it’s not related to the logic of your application. You should handle errors in the flow of your application (like a not allowed extension) with conditional messages and behaviours in the success function, because there were no problem in the call itself. At least that’s what i think.

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

Sidebar

Related Questions

I'm using the script from http://webdeveloperplus.com/jquery/ajax-multiple-file-upload-form-using-jquery/ I modified the onComplete to add a link
I want to write a jQuery file uploading program, using this plug-in http://aquantum-demo.appspot.com/file-upload Despite
I'm coding a form using PHP and jQuery. I have a file upload field
I'm using the jQuery plugin ajaxForm to submit a file upload form via AJAX.
I am using jQuery Form upload. I am unable to upload file with the
How to upload image using jQuery (AJAX) and ASMX web service - asp.net? I
I am using jquery form plugin for file upload . my question is how
I'm using jQuery form plugin to upload files. The plugin uses a hidden iframe
I'm attempting to upload a file asynchronously using HTTP POST and jQuery, but I'm
I have file upload using jquery form plugin as $(function() { $(#Form).ajaxForm({ iframe: true,

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.