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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:01:04+00:00 2026-06-08T05:01:04+00:00

I am using Valums ajax file-upload plugins for multi file-upload using asp.net mvc 3.

  • 0

I am using Valums ajax file-upload plugins for multi file-upload using asp.net mvc 3.

Views

@using (Html.BeginForm("Upload", "AjaxUpload", FormMethod.Post, new { name = "form1", @id="form1" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Upload Wav File</legend>
         <div class="editor-label">
           @Html.Label("Select Active Date Time")
        </div>
        <div>

        <input type="text" id="active" value="@DateTime.Now" />
      </div>

         <div class="editor-label">
           @Html.Label("Select Language")
        </div>
        <div>
           @Html.DropDownList("Language1", (SelectList)ViewBag.lang)
        </div>
         <div class="editor-label">
           @Html.Label("Select Category")
        </div>
        <div>
           @Html.DropDownList("ParentCategoryID", ViewBag.ParentCategoryID as SelectList) 
        </div>
      <br />
      <div id="file-uploader">
            <noscript>
                <p>Please enable JavaScript to use file uploader.</p>
            </noscript>
        </div>
    </fieldset>
}

Scripts

<script type="text/javascript">
    var uploader = new qq.FileUploader
    ({
        element: document.getElementById('file-uploader'),
        onSubmit: function () {
            uploader.setParams({
                param1: document.getElementById("Language1").value,
                param2: document.getElementById("ParentCategoryID").value,
                param3: document.getElementById("active").value
            });
        },

        action: '@Url.Action("upload")', // put here a path to your page to handle uploading
        allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], // user this if you want to upload only pictures
        sizeLimit: 4000000, // max size, about 4MB
        minSizeLimit: 0, // min size
        debug: true
    });

</script>

Controller Action

 [HttpPost]
        public ActionResult Upload(HttpPostedFileBase qqfile, string param1, string param2, string param3)
        {
            var filenam = DateTime.Now.ToString("yyyyMMddhhmmss") + param1 + param2 + Request["qqfile"];
            var filename = filenam.Replace(" ", "_");

           var filepath = Path.Combine(Server.MapPath("~/App_Data/Uploads"), Path.GetFileName(filename));


           if (param2 != null || param2 != "")
           {
               var wav = new PlayWav
               {
                   Name = filename,
                   CategoryID = int.Parse(param2),
                   UserID = repository.GetUserID(HttpContext.User.Identity.Name),
                   LanguageID = int.Parse(param1),
                   UploadDateTime = DateTime.Now,
                   ActiveDateTime = DateTime.Parse(param3),
                   FilePath = filepath
               };

               db.AddToPlayWavs(wav);


               if (qqfile != null)
               {
                   qqfile.SaveAs(filepath);

                   db.SaveChanges();

                   return Json(new { success = true }, "text/html");
               }
               else
               {
                   if (!string.IsNullOrEmpty(filepath))
                   {

                       using (var output = System.IO.File.Create(filepath))
                       {
                           Request.InputStream.CopyTo(output);
                       }

                       db.SaveChanges();

                       return Json(new { success = true });
                   }
               }
           }
            return Json(new { success = false });
        }

Problems Explaination
I have Upload controller action where I have rename the filename for uploaded file and it is working fine. The problem here is that after file is uploaded, file name displayed the name of original file name and also show the file size. But I want to display the file name which is re-named and the value which is selected in dropdown box list and datetime value submitted from form fields and it’s file size is ok. I have no idea how could I modify those content which is displayed after file-upload is completed.

  • 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-08T05:01:05+00:00Added an answer on June 8, 2026 at 5:01 am

    First the new file name is to be returned to clienside as,

    assuming filename to be shown is already yielded in the following line,

    var filenam = DateTime.Now.ToString("yyyyMMddhhmmss") 
                  + param1 + param2 + Request["qqfile"];
    

    this needs to be sent to client side,

    return Json(new { success = true, filename });
    

    client side code changes, notice the onCompleted event handler, its job is to replace the original filename with the new one received from server.

    <script type="text/javascript">
        var uploader = new qq.FileUploader
        ({
            element: document.getElementById('file-uploader'),
            onSubmit: function () {
                uploader.setParams({
                    param1: document.getElementById("Language1").value,
                    param2: document.getElementById("ParentCategoryID").value,
                    param3: document.getElementById("active").value
                });
            },
            onComplete: function (id, fileName, responseJson) {
                $(this.element).find('.qq-upload-list li[qqFileId=' + id + ']').find('.qq-upload-file').html(responseJson.filename);
            },
            action: '@Url.Action("upload")', // put here a path to your page to handle uploading
            allowedExtensions: ['jpg', 'jpeg', 'png', 'gif'], // user this if you want to upload only pictures
            sizeLimit: 4000000, // max size, about 4MB
            minSizeLimit: 0, // min size
            debug: true
        });
    
    </script>
    

    hope this helps.

    EDIT:

    qqFileId attribute in the li element is the only associating link bitween the informative li item and uploaded files.
    Though the qqFileId is not visible in firebug dom structure, in the console executing the following command shows the id,

    $('.qq-upload-list li:last').attr('qqFileId')
    

    if ie browser is causing you the problem it might be because of,

    find('.qq-upload-list li[qqFileId=' + id + ']')
    

    and can be changed as

    onComplete: function (id, fileName, responseJson) {
        $(this.element).find('.qq-upload-list li').each(function () {
            if($(this).attr('qqFileId')==id)
                $(this).find('.qq-upload-file').html(responseJson.filename);
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Valum's fileuploader http://valums.com/ajax-upload/ The below index.html uploads a file, and post.php
I'm using Rails and valums file-uploader for ajax upload. In development all works flawlessly,
Want to upload a file using ajax for this using this uploader http://valums.com/ajax-upload/ and
I am using valums-file-uploader plugin. It allows me to upload files using ajax. I
When using Valums Ajax file uploader, how can I trigger the upload? The default
I am currently using Valums JQuery File Upload plugin. The plugin is very convenient
I am using the Ajax.Upload plugin ( http://valums.com/ajax-upload/ ). I am trying to use
I'm using the AJAX plugin from Andris Valums: AJAX Upload ( http://valums.com/ajax-upload/ ) Copyright
I currently have a ASP.Net MVC web application that needs to upload large files
hii i am using ajax file upload in this code <script type=text/javascript src=fileuploader.js></script> <script

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.