function prosesuploaddata() { $namafileyangdiupload = ""; $ukuranfile = 0; $daftarargumen = func_get_args(); //var_dump ($daftarargumen); $key = func_get_arg(0); //key $kesalahan = func_get_arg(1); //error $site = func_get_arg(2); //site $folder = func_get_arg(3); //folder $namafilefield = func_get_arg(4); //elemen file field $pathfile = namafile($key, $namafilefield, $site, $folder, $namafileyangdiupload); $tipefile = cekatributfile($key, $namafilefield, $ukuranfile); var_dump($kesalahan); switch ($kesalahan) { case UPLOAD_ERR_OK: if ($tipefile) { uploaddata($key, $namafilefield, $pathfile); pesanstatus("sukses dikirim", $namafileyangdiupload); } else { echo "sorry!, bukan tipe jpg/jpeg/pjpeg<br />"; } return "UPLOAD_ERR__OK"; break; case UPLOAD_ERR_INI_SIZE: pesanstatus("gagal dikirim, file lebih besar dari php.ini", $namafileyangdiupload); return "UPLOAD_ERR_INI_SIZE"; break; case UPLOAD_ERR_FORM_SIZE: pesanstatus("gagal dikirim, file > 300 MB", $namafileyangdiupload); return "UPLOAD_ERR_FORM_SIZE"; break; case UPLOAD_ERR_PARTIAL: pesanstatus("gagal dikirim, hanya sebagian file terkirim", $namafileyangdiupload); return "UPLOAD_ERR_PARTIAL"; break; } }
if ($_FILES['video']['name'] != '') { $uploadtype = 35; } else { if ($_FILES['image1']['name'] != '') { $uploadtype = 34; } } if (empty($_FILES) && !empty($uploadtext)) { $uploadtype = 62; uploaddata($uploadtype, $sourcetype, $finaoid, $userid, $uploadtext); } else { if (!empty($_FILES) && !empty($uploadtext)) { uploaddata($uploadtype, $sourcetype, $finaoid, $userid, $uploadtext, $_FILES, $captions); } else { if (!empty($_FILES) && empty($uploadtext)) { uploaddata($uploadtype, $sourcetype, $finaoid, $userid, NULL, $_FILES, $captions); } } } print_r($captions); print_r($_FILES); echo "success"; } else { if ($_REQUEST['json'] == 'changefinaostatus') { $json = array(); $type = mysql_real_escape_string($_POST['type']); // 1=public/private status, 2=finaostatus, 3=completedstatus $userid = mysql_real_escape_string($_POST['userid']); $finao_id = mysql_real_escape_string($_POST['finaoid']); // getting data //$finaoquery = mysql_query("select userid from fn_user_finao where ");
<?php require 'db.php'; require 'utils.php'; $action = $_REQUEST['action']; $id = $_REQUEST['id']; $value = $_REQUEST['value']; $type = $_REQUEST['type']; switch ($action) { case 'datapointAdd': datapointAdd($_REQUEST['value']); break; case 'getCount': echo getCount(); break; case 'datapointnow': echo datapointnow($id, $type); break; case 'uploaddata': uploaddata(); break; default: home(); }
function uploadimagesfinao($userid, $finaoid, $type, $uploadtext, $captions) { $_FILES['image1']['name']; if (!empty($userid)) { if ($type == 1) { $sourcetype = 37; } else { $sourcetype = 36; } if ($_FILES['video']['name'] != '') { $uploadtype = 35; } else { if ($_FILES['image1']['name'] != '') { $uploadtype = 34; } } if (empty($_FILES) && !empty($uploadtext)) { $uploadtype = 62; uploaddata($uploadtype, $sourcetype, $finaoid, $userid, $uploadtext); } else { if (!empty($_FILES) && !empty($uploadtext)) { uploaddata($uploadtype, $sourcetype, $finaoid, $userid, $uploadtext, $_FILES, $captions); } else { if (!empty($_FILES) && empty($uploadtext)) { uploaddata($uploadtype, $sourcetype, $finaoid, $userid, NULL, $_FILES, $captions); } } } $response = generateResponse(TRUE, FINAO_DATA_UPLOAD); echo json_encode($response); } else { getStatusCode(401); $response = generateResponse(FALSE, UNUTHORISED_USER); echo json_encode($response); } }