How to upload file on server with file name which is given from client side
<p>I am uploading file from iphone to sever using php code but when upload it gives random number name to file with my filename so how to remove that number and only filename should remain in script</p>

<pre><code>      &lt;?php
     $uploaddir = './'; //Uploading to same directory as PHP file
     $file = basename($_FILES['userfile']['name']);
     $uploadFile = $file;
     $randomNumber = rand(0, 99999); 
      $newName = $uploadDir . $randomNumber . $uploadFile;


      if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
      echo "Temp file uploaded. \r\n";
     } else {
      echo "Temp file not uploaded. \r\n";
      }



        if (move_uploaded_file($_FILES['userfile']['tmp_name'], $newName)) {
       $postsize = ini_get('post_max_size'); //Not necessary, I was using these
       $canupload = ini_get('file_uploads'); //server variables to see what was 
       $tempdir = ini_get('upload_tmp_dir'); //going wrong.
       $maxsize = ini_get('upload_max_filesize');
        echo "http://www.iroboticshowoff.com/dir/{$file}" . "\r\n" . $_FILES['userfile']   ['size'] . "\r\n" . $_FILES['userfile']['type'] ;
       }
    ?&gt;
</code></pre>
