3
Contributors
4
Replies
26
Views
4 Years
Discussion Span
Last Post by stbuchok
0

I'm pretty new to AJAX so this may look like simple questions but..., so i want my file to be stored in a table in a db i have on my localhost, i'm using iframe

<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>

what source do i provide, what about the id? and this is the php code , what path do i provide in th destination path?

   <?php
   // Edit upload location here
   $destination_path = ;

   $result = 0;

   $target_path = $destination_path . basename( $_FILES['myfile']['name']);

   if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
      $result = 1;
   }

   sleep(1);
?>

<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script>   
0

I'm pretty new to AJAX so this may look like simple questions but..., so i want my file to be stored in a table in a db i have on my localhost, i'm using iframe

Why a <iframe>? I never seen a AJAX with a <iframe> I'm not sure it's gonna to work you can try.

Can you just used a <div> container? It makes more sense and much easier to remember that's how I used AJAX

what source do i provide, what about the id? and this is the php code , what path do i provide in th destination path?

It's incomplete because where do you want the file to be upload? That's not how you target the folder.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.