hi!
i want to create a remote uploader...
i wrote something that you see below:
PHP Code:
<html>
<head>
<title>upload.php</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>  
<script language='javascript' type="text/javascript">
   alert('2e2e');
   function do_upload()
   {
      alert('it works...!');
      var source_url=document.getElementById('url').value;
      //ajax request for remote upload
      $.ajax({
      type: "POST",
      url: "http://ektoplazm.ir/files/upload2.php",
      data: { url: source_url, submit: "Upload" }
      }).done(function( msg ) {
      alert( "Data Saved: " + msg );
      });
      //continue : update upload status
      setInterval('update_upload_status()',512);
   }

   function update_upload_status(){
      alert('upload is starting...');
      var source_url=document.getElementById('url').value;
      var destination_url=source_url.substring(source_url.lastIndexOf('/')+1);
      var sfilesize;
      var dfilesize;
      var request;
      
      request = $.ajax({
      type: "HEAD",
      url: $("#"+source_url).val(),
      success: function () {
      sfilesize=request.getResponseHeader("Content-Length"));
      }
    
      request = $.ajax({
      type: "HEAD",
      url: $("#"+destination_url).val(),
      success: function () {
      dfilesize=request.getResponseHeader("Content-Length"));
      }
    
      var progress=dfilesize/sfilesize*100;
      if (progrss==100){
         document.getElementById('progress').innerhtml='done!';
      }else{
         document.getElementById('progress').innerhtml=progress;
      }
 

   }

   
</script> 
</head>
<body>
<form action='' method="post">
<input name="url" size="50" />
<input name="upload" type="button" value='upload' onclick="javascript:do_upload();" />
</form>
<p id='progress'>progress</p>
</body>
</html>
<?php

// maximum execution time in seconds
set_time_limit (24 60 60);

if (!isset(
$_POST['submit'])) die();

// folder to save downloaded files to. must end with slash
$destination_folder '';

$url $_POST['url'];
$newfname $destination_folder basename($url);

echo 
$url;

$file fopen ($url"rb");
if (
$file) {
  
$newf fopen ($newfname"wb");

  if (
$newf)
  while(!
feof($file)) {
    
fwrite($newffread($file1024 ), 1024 );
  }
}

if (
$file) {
  
fclose($file);
}

if (
$newf) {
  
fclose($newf);
}

?>
i don't know why this code does not work correctly. javascript section does not run.
help me... i'm beginner!