upload php > Kotlin

본문 바로가기

사이트 내 전체검색

Kotlin

upload php

작성일 20-07-18 08:02

페이지 정보

작성자sbLAB 조회 4,201회 댓글 0건

본문

android api30(갤럭시10) 부터는 갤러리 저장공간에 직접접근하지 못함 -> 어플아래 폴더에 복사시킨 다음 수정/편집/전송 등 작업 가능


[클라이언트에서 전송된 파일저장 PHP]

<?php
$fileuuid=$_POST["fileuuid"];

$target_dir = "uploads/";
$target_file_name = $target_dir.$fileuuid;
$response = array();

if(isset($_FILES["file"]))
{
    if(move_uploaded_file($_FILES["file"]["tmp_name"],$target_file_name)){
        $success = true;
        $message = "Uploaded!!!";
    }else{
        $success = false;
        $message = "NOT Uploaded!!! _ Error While Uploading";
    }

}else{
    $success = false;
    $message = "missing field";
}

$response["success"] = $success;
$response["message"] = $message;

echo json_encode($response);
?>


[업로드파일 리스트]

<?php   
echo "<span style='font-size:13px'>";
$dir = "./uploads/";
 
$i=0;
 
if (is_dir($dir)){                              
  if ($dh = opendir($dir)){                     
    while (($file = readdir($dh)) !== false){   
     if ($file == "." || $file == "..")continue;
   $i=$i+1;
    echo $i.") <a href=./uploads/".$file.">".$file."</a><br>";        
    }                                           
    closedir($dh);                              
  }                                             
}           
?>        


첨부파일

댓글목록

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.
PC 버전으로 보기