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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:25:34+00:00 2026-05-22T16:25:34+00:00

I am using an html form to upload a file to my server. I

  • 0

I am using an html form to upload a file to my server. I want to execute a javascript function only after the form has been submitted and the file has been successfully uploaded. The form opens a new page with the text “upload succeeded” if the file upload worked. I tried using a while loop that would loop until the file was found in the database but it crashed my browser. How can I do this? I’m using myform.submit() to submit my form right now.

  • 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-22T16:25:35+00:00Added an answer on May 22, 2026 at 4:25 pm

    You can use AJAX to upload you file and you the async return function (this is a event that will trigger when your request is done) to ether a success or failed message from you php.

    EDIT:

    Here is a ajax function iv made that u can use, just load this in an extenal file:

    var ajax = function(data){
    // Return false is no url... You need an url to get url data..
    if(typeof data.url !== 'undefined'){
        var url = data.url;
        // Adept the function depending on your method
        if(data.method === 'GET' && data.params  !== 'undefined'){
        url+='?'+data.params;
        }
    }else{
        return(false);}
    var // Set some vars 'n' stuff
    method      = ( data.method  === 'GET') ? 'GET' : 'POST',
    params      = (typeof data.params  !== 'undefined') ? data.params   : null,
    async       = ( data.async   === true) ? true    : false,
    done        = (typeof data.done    === 'function')  ? data.done     : false,
    return_value    =  null,
    length      = (data.method  === 'POST') ? data.method.length : '';
    
    var // Find out what ajax methods the browser support
        request_method  =  function(){
        var xmlhttp =  false;
        try {
        xmlhttp = new XMLHttpRequest();
        } catch (trymicrosoft) {
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (othermicrosoft) {
            try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (failed) {
            xmlhttp = false;
            }
        }
        }
        return xmlhttp;
    }// This thing connet to the server
    connect = function(){
        if(request = request_method()){}else{
        return(false);
        }
        request.open(method, url, async);
        request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        request.setRequestHeader("Content-length", length);
        request.setRequestHeader("Connection", "close");
        request.send(params);
        request_handle(request);
    },// This is where the result get processed
    request_handle = function(request){
        if(async){
        request.onreadystatechange = function() {
            if(request.readyState === 4 && request.status === 200) {
            done(data);
            }
        }
        }else{
        done(data);
        }
    };
    
        connect();
    return(return_value);
    }
    

    usage:

        ajax({
            url:    'test.php', 
            //// Your ajax request url              // no default // Must be set! 
            method: 'POST',  
            //// Method of sending ajax data            // default is POST
            async:  true, 
            //// What to do when done with the request      // no default
            done:   function(http){
            table(http,'test');
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm uploading a file to the server. The file upload HTML form has 2
I am using html, javascript & mod_python. I want to submit html form. To
This piece of valid json (it has been generated using php's json_encode): {html:form is
I need to upload a pic on server without using html form tag. Is
Ive been working on create a file upload form using PHPmailer to send as
I'm trying to upload a file using PHP. My HTML page with the form
Is it possible to make a upload progress using javascript only? (maybe with some
i am using jquery form plugin for file upload . i am not able
below is my simple code using HTML 5 multiple file upload. All i need
I am using a HTML form to upload image files. Now i am using

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.