Page 1 of 1

Upload File using AJAX...

Posted: Thu May 17, 2007 12:51 pm
by kendall
HOW does it work? :?: :?: :? :?:

Posted: Thu May 17, 2007 3:09 pm
by thiscatis
I don't think it's possible.
There are some hacks, but you will first have to ask your visitors to tweak your FF for an hour.

Posted: Thu May 17, 2007 6:38 pm
by Weirdan

Code: Select all

<iframe name="upload_frame" style="margin-left:-10000"></iframe>
<form action="upload.php" target="upload_frame" method="post" enctype="multipart/form-data" id="upload_form">
   <input type="file" name="file" />
   <input type="submit" />
</form>
upload.php

Code: Select all

<?php
  //.... handle file
?>
<script type="text/javascript">
  var message = window.top.createElement('div');
  message.innerHTML = '<strong>upload finished</strong>';
  var form = window.top.getElementById("upload_form");
  form.parentNode.replaceChild(form, mesage);
</script>
Simple, elegant and buzzword-free.