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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:03:44+00:00 2026-05-28T06:03:44+00:00

I already search about this and I cannot use ajax in file uploading, but

  • 0

I already search about this and I cannot use ajax in file uploading, but all I need to do is process my file through an ajax then pass it to my controller (where I created and object file to save in a directory), so how can I process an upload file trough an ajax mootols, I already do it and nothings happens, no plugins please, I need just to someone guide me

this is my code

       #f1_upload_process{
           z-index:100;
           position:absolute;
           visibility:hidden;
           text-align:center;
           width:400px;
           margin:0px;
           padding:0px;
           background-color:#fff;
           border:1px solid #ccc;
       }
       </style>



   <p id="f1_upload_process">Loading...<br/></p>

   <p id="result"></p>

    <form method="post" action="" enctype="multipart/form-data">   

        <label for="file">Subir un archivo</label>
        <input type="file" name="file" id="fileArchivo" />
        <input type="submit" name="submit" id="btnSubir" value="upload file" />  

   <iframe name="iframUpload" id="iframeUpload" type="file" style="display:none"></iframe>


        </form>

mootools ajax

window.addEvent("domready",function(){
    cargarIndex();                                
});


function cargarIndex()
{   
   var prueboRequest = new Request({
   method: 'POST', 
   url: '../CONTROLLER/inicio.php',
   onRequest: function() {}, 
   onSuccess: function(texto, xmlrespuesta){
   document.getElementById('subirarchivo').innerHTML= texto;
   $('btnSubir').addEvent('click',function(){beginUploading()});  
   },
   onFailure: function(){alert('Error!');}  
   }).send();


}

function beginUploading(){

   var prueboRequest = new Request({
   method: 'POST', 
   url: '../Controller/ControllerSubirArchivo.php',
   onRequest: function() {}, 
   onSuccess: function(texto, xmlrespuesta){
   onFailure: function(){alert('Error!');}  
   }).send();

I already search but all I have found is this but with jquery, and I want something similar to:

$(function(){
    var btnUpload=$('#upload');
    var status=$('#status');
    new AjaxUpload(btnUpload, {
        action: 'upload-file.php',
        //Name of the file input box
        name: 'uploadfile',
        onSubmit: function(file, ext){
            if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
                  // check for valid file extension
                status.text('Only JPG, PNG or GIF files are allowed');
                return false;
            }
            status.text('Uploading...');
        },
        onComplete: function(file, response){
            //On completion clear the status
            status.text('');
            //Add uploaded file to list
            if(response==="success"){
                $('<li></li>').appendTo('#files').html('<img src="./uploads/'+file+'" alt="" /><br />'+file).addClass('success');
            } else{
                $('<li></li>').appendTo('#files').text(file).addClass('error');
            }
        }
    });
});

}

  • 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-28T06:03:44+00:00Added an answer on May 28, 2026 at 6:03 am

    As Dimitar Christoff said, no way to have an ajax file upload without a little bit of cross browser headache for now…
    I would recommend the plupload project so you’re sure it’s cross browser. A plugin from the forge could also do the trick but separating the javascript file upload library is a good idea these days. Considering that the implementation of the HTML5 API is still partial on a lot of browsers, you may have to update the script soon…

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

Sidebar

Related Questions

I'm sorry if this was already answered, but it's kind of difficult to search
I have a project using Lucene3.5 already. Now i need to provide web search
Already found this page with some helpful hints. Problem is I need to debug
Okay, I know this question have been asked plenty of times already, but I
A customer need a document managment system and I'm building information about this. I
What is this about I notice many many apps I use have a similar
This question is similar to this question about subtracting dates with Python , but
I have read many posts about this now but I do not still understand
I already looked up many posts about this problem (subqueries being very slow in
I don't know if this question is already answered on stackoverflow. But I simply

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.