¿©·¯ ¼Ò½º¸¦ Âü°íÇÏ¿© ¸¸µé¾ú´Âµ¥ ¼¹ö¾÷·Îµå ºÎºÐ¿¡¼ ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù. ¹¹°¡ ¹®Á¦ÀÎÁö Á» ºÁÁÖ¼¼¿ä
//À̹ÌÁö ÀúÀå
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
String fileLoute =Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/Camera/";
File saveFile=new File(fileLoute + "image01.jpg");
OutputStream out=null;
saveFile.createNewFile();
out=new FileOutputStream(saveFile);
bitmap.compress(CompressFormat.JPEG,70,out);
//¼¹ö¾÷·Îµå
File file=new File(fileLoute + "image01.jpg");
HttpClient client = new DefaultHttpClient();
String postURL="
http://111.124.245.27/test.php";
HttpPost post = new HttpPost(postURL);
FileBody bin = new FileBody(file);
MultipartEntity reqEntity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("myFile",bin);
post.setEntity(reqEntity);
//PHP SERVER
$target_path="./";
$tmp_img=explode(".",$_FILES['uploadedfile']['name']);
$img_name=$tmp_img[0] . "." . $tmp_img[1];
$target_path=$target_path . basename($img_name);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path)){
echo "The file has been uploaded";
}else{
echo $img_name;
echo "There was an error";
}
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)