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

The Archive Base Latest Questions

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

i’m using prototype for an easy notation of ajax requests/updates, now i got this

  • 0

i’m using prototype for an easy notation of ajax requests/updates, now i got this form on my page that makes it possible to upload multiple files (html5 allows the basic form)
But whenever i click the submit button the form opens up the action page.
i don’t like it to do this is there a way to disable the refresh and still submit the post data sent from the form?

i have tried “return false” on a submit but this still refreshes my page

code of form:

<form id='uploadfrm' onSubmit='check();return false;' action='upload_handler.php' enctype='multipart/form-data'>
        <input type='file' name='files[]' multiple='multiple' min='1' max='9999'/>
        <input type='hidden' name='msid' id='ms_id' value='5' />
        <input type='submit' value='upload' onClick='check();' />
    </form> 

code of ajax request that gets the form to my page:

new Ajax.Updater('uploadform','ajax-parser.php',{

            parameters: {
                action: 'get_mediaupload'
            }
        });

where uploadform is a hidden div and action is a var on which i switch in my parser, however hidden i can still let it see through ligthview using

Lightview.show( { href: ‘#uploadform’,
options: { autosize: true, topclose: true } });

i have also tried the ajax serialize() and request methods to do a submit from ajax side but both tries have been unsuccesfull.

the setup of my page is very simple i have an index page and an ajax-parser filled with php code to send ajax requests to, and ofc an upload handler
code of handler:

if (isset($_FILES['files'])){
    foreach($_FILES['files']['name'] as $key=>$tmp_name)
    {
        echo $_FILES['files']['name'][$key];

    $upload_dir= "upload/" . $_FILES['files']['name'][$key];
    echo $upload_dir;
    if(move_uploaded_file($_FILES['files']['tmp_name'][$key], $upload_dir)) {
        echo "The file ".  $_FILES['files']['name'][$key]. 
        " has been uploaded";
    } else{
        echo "There was an error uploading the file, please try again!";
    }

}

}

  • 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-30T16:23:54+00:00Added an answer on May 30, 2026 at 4:23 pm

    Hese is the perfect solution for upload file without refresh….

    <script type="text/javascript">
     function init() {
        document.getElementById("slide_upload_form").onsubmit=function() {
        document.getElementById("slide_upload_form").target = "iframe_upload_target";
        document.getElementById("iframe_upload_target").onload = uploadDone;
            }
      }
    </script>
    <script type="text/javascript">
     window.onload=init; 
    </script>
    
    <script type="text/javascript">
     function uploadDone() {
    var ret = frames['iframe_upload_target'].document.getElementsByTagName("body")[0].innerHTML;
    var data = eval("("+ret+")"); 
        alert(data);
        if(data.error_msg == "null") {
        alert('Invalid Browse Image...');
     }
     </script>
    
    <form id="slide_upload_form" method="post" enctype="multipart/form-data" 
         action="<?php echo SITE_URL."uploadslidecontent/index"?>">
          <iframe id="iframe_upload_target" onload="uploadDone()" name="iframe_upload_target"  
          src="" style="width:1px;height:1px;display:none"></iframe>
     <label><span>Image:</span>
        <input name="slideOneImg" id="slideOneImg" type="file" />
      </label>
    </form>
    

    how to validate if browser field is null so post return to data like this
    uploadslidecontent/index

    if($file_name == ''){
                print json_encode(array(
                    "error_msg" =>  'null'
    ));
    

    No cross Browser Issue…..

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't

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.