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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:06:23+00:00 2026-06-18T17:06:23+00:00

i created a module for uploading contents. it is basically done by file api.

  • 0

i created a module for uploading contents. it is basically done by file api.

the html code is

    <input type="file" id="filepicker-input" multiple="true" style="display:none;"/>  
    <div class="addfile_btndiv" id="addfile_btndiv">
    <span id="direct-upload-text"><input name=""  class="add_filebtn" type="button" value="Add Files" /></span>
    </div>
    <div id="dropped-files">

    </div>

    <div class="clear"></div>
    </div>

the operation is taken place when onchange the file.
the js code is

 var fileInput  = document.getElementById("filepicker-input");
 document.getElementById("direct-upload-text").onclick = function(e){
    fileInput.click();
 }
 fileInput.onchange = function(e) {

//basically same as in ondrop
    $("#dropped-files").html("");

    var files = e.target.files;

    var type            = 'zip';
    var location_block  = 1;
    var check = createPreviewElements(files, type, location_block);

    if(check){

        //add an onclick property to the upload button, this will trigger the main upload process
        var uploadButton    = document.getElementById('upload_button_zip_1');

        uploadButton.onclick = function(e){
            var block   = document.getElementById("current_block");
            block.value = location_block;
            uploadButton.onclick = null; //disable the onclick event once it happened
            document.getElementById('loading_wrapper').style.display = 'inline';
            setTimeout(function(){$('#loading_wrapper').fadeOut()}, 6000);  //fade out loader after 2 sec
            startupload(files, type, location_block);
        };
    }


} 

the uploading is working perfectly. my problem is that there is a cancel button present for this uploading. i managed this by some javascript code but after when the user can reselect the same file then ‘onchange’ will not trigger. so i add a new logic in cancel button that remove the current input type and place a new input type. the code is

            $('#filepicker-input').attr("id", "newID");
    var foo     = document.getElementById("blk_switchbox1");
    var olddiv  = document.getElementById("newID");
    foo.removeChild(olddiv);
    var element = document.createElement("input");

    element.setAttribute("type", "file");
    element.setAttribute("id", "filepicker-input");
    element.setAttribute("class", "nodisplay");


    foo.appendChild(element);

this working fine in mozila. but not in chrome. in chrome there is any cashing present for dom elements. please help me

  • 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-18T17:06:25+00:00Added an answer on June 18, 2026 at 5:06 pm

    Have you tried triggering the change event manually? Rather than its click event?

    document.getElementById("direct-upload-text").onclick = function(e){
        if(fileInput.value != '') {
            fileInput.change();
        } else {
            fileInput.click();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got (working) application done with ttk. It uses self-created module for showing a
I just created a module location.rb inside /lib folder with following contents: module Location
I created one module in Magento. I create Api.php in that. Now I want
i am new to yii. I just created a module in yii the file
I created a module and controller using: $ zf create module api $ zf
I created module for admin specific operations. I don't want to write the same
I created module in netBean platform, then I created window component there, and I
I created a module to add some Extension Methods to a Class. This Class
i have created a module with this among others this function in it: <?php
I have a DotNetNuke Module created in DNN 4.9.2. It runs fine on my

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.