HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(url);
File file = new File(mfilepath);
FileBody bin = new FileBody(file);
MultipartEntity multipart = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
multipart.addPart("images",bin);
post.setEntity(multipart);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
Log.d("ErrorLog", "in");
if(resEntity != null){
String res = EntityUtils.toString(resEntity);
Log.d("ErrorLog", res);
}else{
Log.d("ErrorLog", "null");
}
이렇게 햇구요..
php부분좀 봐주세요 ㅠㅠ
<?php
define('SITE_ROOT',realpath(dirname(__FILE__)));
$myFile = $_FILES['images']['name']; // Storing name into variable
$newFileName = (iconv('utf-8','euc-kr',$myFile));//===New string is concatenated====
if (file_exists(SITE_ROOT."/talktalk/images/".$newFileName)){
echo $newFileName." already exists. ";
}else{
move_uploaded_file($_FILES['images']['tmp_name'],SITE_ROOT."/talktalk/images/".$newFileName);
echo "Success";
}
?>
이렇게 햇는데..
에러가..
<b>Warning</b>: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/tmp/phpD7WxuT' to '/home/hosting_users/wizcompany/www/talktalk/images/talktalk/images/1367210371835.jpg' in <b>/home/hosting_users/wizcompany/www/talktalk/images/imageupload.php</b> on line <b>15</b><br />
이렇게 뜨거든요.. 경로가 없다는것 같은데.. 그래서 define문도 써보구.. 폴더두 확인 해보구 햇는데 ㅠㅠ
이게 몇일째 해결이 안되네요 ㅜㅜ 아시는 분 있으신가요?