我试图上传一个文件,它说SUCCESS但文件没有来到服务器..
我的java:
File file = new File(Constantes.getLeiFileFullPath(texto.getID()));
RequestParams parms = new RequestParams();
try {
parms.put("file", file);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
AsyncHttpClient client = new AsyncHttpClient();
client.post("http://myserver.net/up.php", parms, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Log.d("POSTFILE", "SUCESSU " + statusCode);
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
Log.d("POSTFILE", "FAILURE");
}
});
和PHP:
<?php
/* Insira aqui a pasta que deseja salvar o arquivo*/
$uploaddir = "uploads/";
$uploadfile = $uploaddir . $_FILES['file']['name'];
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)){
echo "Arquivo Enviado";}
else {echo "Arquivo não enviado";}
?>
错误的是它没有创建文件但是说&#34; SUCCESS&#34;?