I am trying to connect the android emulator to my localhost (xampp) and send a file to a folder. 

I am using the code from slott - [wrapping the code up in an Async task to avoid threading errors](https://stackoverflow.com/questions/4126625/how-to-send-a-file-in-android-from-mobile-to-server-using-http)

and calling it via:

```
new AsyncHttpPostTask("http://10.0.2.2/android").execute(new File(myFile));

```

myFile is a valid file with some text

the folder "android" exists directly under the "xampp/htdocs" folder on the c drive

I have added the internet permission in the manifest

I have deleted my AVD and created a new one

XAMPP is running, the path is valid if i open it in a browser e.g. `http://localhost/android`

After executing the code, i get a **"301 Moved Permanently"** response from the localhost server 

Any ideas on what i have done wrong or how i can investigate further?

==EDIT

I was missing the php file on my path. I am using the following PHP

```
<?php
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
  echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
  move_uploaded_file ($_FILES['userfile'] ['tmp_name'], $_FILES['userfile'] ['name']);
} else {
  echo "Possible file upload attack: ";
  echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";
  print_r($_FILES);
}
?>

```

I havent used PHP before however i am able to connect now but getting the following error in the response:

**Undefined index in the server.php file**