Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $image = $_FILES['file']['tmp_name'];
- $imagename = $_FILES['file']['name'];
- $file_path = $_SERVER['DOCUMENT_ROOT'] . '/foto';
- $response = array();
- if (!file_exists($file_path)) {
- mkdir($file_path, 0777, true);
- }
- if(!$image){
- $response["kode"] = 0;
- $response["pesan"] = "Gambar Tidak Ditemukan";
- }
- else{
- if(move_uploaded_file($image, $file_path.'/'.$imagename)){
- $response["kode"] = 1;
- $response["pesan"] = "Gambar Sukses Diupload";
- }
- }
- echo json_encode($response);
Add Comment
Please, Sign In to add comment