Upload File using AJAX...

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Upload File using AJAX...

Post by kendall »

HOW does it work? :?: :?: :? :?:
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post 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.
Post Reply