php - How to sent uploaded image details(name,size, temp_name,error) for upload using JavaScript -


i submiting form using javascript. want store/move image folder using javascript.
html code -

<form id="exampleform" method="post" action=""  enctype="multipart/form-data" >       <input  type="file" name="imagename" id="imagename" />      <input type="button" name="save_exit"  id="save_exit" onclick="submitform('add_question_sql.php')" value="save &amp; exit"  />  </form> 

javasript code-

function submitform(action) {     document.getelementbyid('exampleform').action = action;     document.getelementbyid('exampleform').submit();// submiting form } 

so how sent image details (name, size, temp_name,error) action page move uploading process.

try

 <form id="exampleform" method="post" enctype="multipart/form-data" >              <input  type="file" name="imagename" id="imagename" />              <button>submit</button>     </form> 

ajax:

$("form#exampleform").submit(function(){      var formdata = new formdata($(this)[0]);      $.ajax({         url:'add_question_sql.php',         type: 'post',         data: formdata,         async: false,         success: function (data) {             alert(data)         },         cache: false,         contenttype: false,         processdata: false     });      return false; }); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -