<?php include_once "../controller/cExpediente.php"; include_once "../helper/uploadFileClass.php"; $upo = new uploadFile(); $exped = new cExpediente(); if (isset($_POST['obligado'])) { $m = $exped->regExpedienteClteObligado('', $_POST['txtApellidoPaterno'], $_POST['txtApellidoMaterno'], $_POST['txtNombre'], $_POST['txtFechaNacimiento'], $_POST['tipoExp'], $_POST['compartir'], $_POST['prestarsinob'], 1, $_POST['ciudadnac'], $_POST['txtEstadoNac'], $_POST['txtTelefono'], $_POST['txtCorreo'], $_POST['txtCURP'], $_POST['txtRFC'], $_POST['txtNacionalidad'], $_POST['generoQ'], $_POST['giro'], $_POST['txtObservaciones'], $_POST['id_persona2']); } else { $m = $exped->regNvoExp('', $_POST['txtApellidoPaterno'], $_POST['txtApellidoMaterno'], $_POST['txtNombre'], $_POST['txtFechaNacimiento'], $_POST['tipoExp'], $_POST['compartir'], $_POST['prestarsinob'], 1, $_POST['ciudadnac'], $_POST['txtEstadoNac'], $_POST['txtTelefono'], $_POST['txtCorreo'], $_POST['txtCURP'], $_POST['txtRFC'], $_POST['txtNacionalidad'], $_POST['generoQ'], $_POST['giro'], $_POST['txtObservaciones'], $_POST['id_persona2']); } $exped->creaPerfilTrans($m, $_POST['ingreso'], $_POST['origen_recursos'], $_POST['giro'], $_POST['destino_recursos'], $_POST['montooperaciones'], $_POST['numoperaciones']); $iddom = $exped->regDomClte($m, $_POST['txtCalle'], $_POST['txtAvenida'], $_POST['txtNumeroEx'], $_POST['txtNumeroIn'], $_POST['txtColonia'], $_POST['txtCodigoPostal'], $_POST['txtCiudad'], $_POST['txtEstado'], '', 1, $_POST['txtDelegacion'], $_POST['txtPais'], 'no def', 'no def', $_POST['referenciaDom'], '', '', 1); $exped->regDetallesExpe($m, $_POST['txtOcupacion'], $_POST['origen_recursos'], $_POST['destino_recursos'], 0, 1, '', '', '00:00', '', '', '', ''); $exped->regEmpleoClte($m, '', '', '', '', '', '', '', '', $_POST['ingreso'], '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); echo "EXPEDIENTE REGISTRADO CON ÉXITO"; //registra los adjuntos //identificacion oficial if (!empty($_FILES['identificacionOficial']['name'])) { $upo->guardarArchivo('identificacionOficial', $m); $exped->regAdjuntoExpend($_FILES['identificacionOficial']['name'], $m, $_POST['tipoDocIden']); } else { $exped->regAdjuntoExpend("sin adjunto", $m, $_POST['tipoDocIden']); } //comprobante de domicilio if (!empty($_FILES['comprobanteDom']['name'])) { $upo->guardarArchivo('comprobanteDom', $m); $exped->regAdjuntoDom($iddom, $_FILES['comprobanteDom']['name'], $_POST['tipoDocDom']); } else { $exped->regAdjuntoDom($iddom, "sin adjunto", $_POST['tipoDocDom']); }
/** * 上傳多個文件 * * @param String $fileName Input名稱 * @param array $allow_type 允許上傳的文件類型 * @return array(name,size,url) name原文件名稱,size原文件大小,url保存的路徑名稱 */ public function multi_attach($fileName, $allow_type = null) { if ($_FILES[$fileName]['name']) { foreach ($_FILES[$fileName]['name'] as $k => $v) { $up_file['name'] = $_FILES[$fileName]['name'][$k]; $up_file['type'] = $_FILES[$fileName]['type'][$k]; $up_file['tmp_name'] = $_FILES[$fileName]['tmp_name'][$k]; $up_file['error'] = $_FILES[$fileName]['error'][$k]; $up_file['size'] = $_FILES[$fileName]['size'][$k]; unset($file_data); $file_data['name'] = $up_file['name']; $file_data['size'] = $up_file['size']; $upload = new uploadFile(); $type = self::$allow_attach_type; if ($allow_type) { $type = $allow_type; } $upload->setAllowFileType($type); $path = 'upload/' . date('Y/m/'); $file = $upload->upload($up_file, ROOT_PATH . $path); if ($file) { $file_data['url'] = $path . $file; $file_ary[$k] = $file_data; } else { $file_ary[$k] = false; } } return $file_ary; } }
<?php include_once '../controller/cExpediente.php'; include_once "../helper/uploadFileClass.php"; $expe = new cExpediente(); $upo = new uploadFile(); //registra en la tabla clientes_todos //guarda en la tabla clientes_todos /* * parametros * razon = null * apellido paterno * apellido materno * nombre * fecha de nacimiento * tipo de expediente (int) * compartir cliente con otras sucursales (boolean) * prestar sin aval (boolean) * id_sucursal (int) * ciudad de origen * estado de origen * telefono * email * curp * rfc * nacionalidad * sexo (boolean) * giro * */ //inserta un nuevo cliente
<h3>Seleccione tipo de documento</h3> <select name="idadjunto"> <?php while ($l = $lcata->NextRow()) { ?> <option value="<?php echo $l['id_adj']; ?> "><?php echo $l['tipo']; ?> </option> <?php } ?> </select> <button>Subir Adjunto</button> </form> <?php } else { include_once "../helper/uploadFileClass.php"; include_once "../controller/cExpediente.php"; $upload = new uploadFile(); $expe = new cExpediente(); echo "<br>idclte" . $_POST['idclte']; echo "<br>tipo" . $_POST['tipo']; echo "<br>id_ad" . $_POST['id_ad']; $nvoDocto = $upload->guardarArchivo('nvoDocto', $_POST['idclte']); // $expe->acutalizaAdjunto($_POST['idclte'], $_FILES['nvoDocto']['name'], $_POST['idadjunto']); $expe->actualizaAdjunto($_POST['id_ad'], $nvoDocto, $_POST['tipo']); }
function onupfilesave() { require_once admin_ROOT . '/public/class_upload.php'; $temppath = $this->fun->accept('path', 'P'); $temppath = empty($temppath) ? $this->CON['upfile_dir'] : $temppath; $path = admin_ROOT . $temppath; if (!$this->fun->filemode($path)) { exit($this->lng['filemanage_js_upfile_no']); } $amid = $this->fun->accept('amid', 'P'); $isamid = $this->fun->accept('isamid', 'P'); $title = $this->fun->accept('title', 'P'); $lng = $this->fun->accept('lng', 'P'); if ($isamid) { if (empty($title)) { exit($this->lng['download_mess_size_err6']); } $db_table = db_prefix . 'album_images'; $date = time(); $db_field = 'pid,lng,title,content,pic,addtime,isclass,istop'; $db_values = "50,'{$lng}','{$title}','{$title}','',{$date},1,0"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')'); $amid = $this->db->insert_id(); } $upfilepath = $this->fun->accept('upfilepath', 'P'); $img_issmallpic = $this->fun->accept('img_issmallpic', 'P'); $img_issmallpic = empty($img_issmallpic) ? 0 : $img_issmallpic; $img_width = $this->fun->accept('img_width', 'P'); $img_width = empty($img_width) ? 0 : ceil($img_width); $img_height = $this->fun->accept('img_height', 'P'); $img_height = empty($img_height) ? 0 : ceil($img_height); $img_issmallpic = $img_width < 1 || $img_height < 1 ? 0 : $img_issmallpic; $img_iswater = $this->fun->accept('img_iswater', 'P'); $img_iswater = empty($img_iswater) ? 0 : $img_iswater; $type = $this->fun->accept('filetype', 'P'); $type = empty($type) ? 'img' : $type; $isgetback = intval($this->fun->accept('isgetback', 'P')); $isgetback = empty($isgetback) ? 0 : $isgetback; $dirdate = $this->fun->accept('dirdate', 'P'); if ($isgetback == 1) { $dirdate = 'list'; } else { $dirdate = empty($dirdate) ? $this->CON['img_dirtype'] : $dirdate; } $filenametype = $this->fun->accept('filenametype', 'P'); $filenametype = empty($filenametype) ? $this->CON['img_cfiletype'] : $filenametype; $iszoom = $this->fun->accept('iszoom', 'P'); $iszoom = empty($iszoom) ? $this->CON['img_iszoom'] : $iszoom; $filename = $_FILES['upfilepath']['name']; $filesize = intval($_FILES['upfilepath']['size']); $filetmpname = $_FILES['upfilepath']['tmp_name']; $fileerror = $_FILES['upfilepath']['error']; $filetype = $_FILES['upfilepath']['type']; if ($filesize <= 0 || $filesize > intval($this->CON['upfile_maxsize'])) { exit($this->lng['download_mess_size_err2']); } $upfile = new uploadFile(); $filename = $upfile->upfilebase($img_width, $img_height, $img_issmallpic, $img_iswater, $path, $filename, $filesize, $filetmpname, $fileerror, $filetype, $type, $dirdate, $filenametype, $iszoom); if ($filename) { $db_table = db_prefix . 'filename'; $date = time(); $filename = str_replace(admin_ROOT, '', $filename); list($uploadfile, $toImagesFile, $outfiletype, $filepath, $iswidth, $extension) = explode('|', $filename); if (!empty($uploadfile)) { $pathnow_array = preg_split('(\\\\|/)', $filepath); $pathnow = is_array($pathnow_array) ? count($pathnow_array) - 2 : 0; unset($pathnow_array[0]); $db_field = 'username,filetitle,filename,filetype,filepath,addtime,iswidth,extension,pathnow'; for ($index = 0; $index < count($pathnow_array) - 1; $index++) { $keyid = $index + 1; $updirname = $pathnow_array[$index]; $filename = $pathnow_array[$keyid]; $dirname_len .= !empty($updirname) ? $pathnow_array[$index] . '/' : null; $dirfilepath = empty($updirname) ? $this->CON['upfile_dir'] : $this->CON['upfile_dir'] . $dirname_len; $db_where = " WHERE pathnow={$index} AND filename='{$filename}' AND filepath='{$dirfilepath}'"; $countnum = $this->db_numrows($db_table, $db_where); if ($countnum <= 0) { $db_values = "'{$this->esp_username}','','{$filename}','dir','{$dirfilepath}',{$date},0,'dir',{$index}"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')'); } } $db_values = "('{$this->esp_username}','','{$uploadfile}','{$outfiletype}','{$filepath}',{$date},{$iswidth},'{$extension}',{$pathnow})"; if ($toImagesFile) { $db_values .= ",('{$this->esp_username}','','{$toImagesFile}','{$outfiletype}','{$filepath}',{$date},{$iswidth},'{$extension}',{$pathnow})"; } $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES ' . $db_values . ''); if ($amid && $outfiletype == 'img') { $insert_id = $this->db->insert_id(); $db_table = db_prefix . 'album_file'; $db_field = 'amid,fiid,filetitle,filedes,filename,filepath,iswidth,addtime'; $db_values = "({$amid},{$insert_id},'{$uploadfile}','','{$uploadfile}','{$filepath}',{$iswidth},{$date})"; if ($toImagesFile) { $db_values .= ",({$amid},{$insert_id},'{$toImagesFile}','','{$toImagesFile}','{$filepath}',{$iswidth},{$date})"; } $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES ' . $db_values . ''); } } } if ($uploadfile) { if ($toImagesFile) { exit($filepath . $uploadfile . '|' . $outfiletype . '|' . $iswidth . '|' . $filepath . $toImagesFile); } else { exit($filepath . $uploadfile . '|' . $outfiletype . '|' . $iswidth . '|'); } } else { exit('false'); } }
<?php include_once "../controller/cExpediente.php"; include_once "../helper/uploadFileClass.php"; var_dump($_POST); $adjuntos = new uploadFile(); $exped = new cExpediente(); //expediente $m = $exped->regNvoExp($_POST['txtRazonSocial'], '', '', '', $_POST['txtFechaConstitucion'], $_POST['tipoExp'], $_POST['compartir'], $_POST['prestarsinob'], 1, $_POST['ciudadOrigen'], $_POST['edoOrigen'], $_POST['txtTelefono'], $_POST['txtEmail'], 'N/A', $_POST['txtRFC'], $_POST['nacionalidad'], 1, $_POST['giro'], $_POST['txtObservaciones']); $exped->creaPerfilTrans($m, $_POST['ingreso_mensual'], $_POST['origen_recursos'], $_POST['giro'], $_POST['destino_recursos']); //domicilio $dom = $exped->regDomClte($m, $_POST['txtCalle'], $_POST['txtAvenida'], $_POST['numext'], $_POST['numint'], $_POST['txtColonia'], $_POST['txtCP'], $_POST['txtCiudad'], $_POST['txtEstado'], '', 1, $_POST['txtDelegacion'], $_POST['txtPais'], '', '', '', '', '', $_POST['referenciaDom']); for ($i = 1; $i <= $_POST['numReprs']; $i++) { $repre = $exped->regMiembrosPM($m, $_POST['txtApePaterno' . $i], $_POST['txtApeMaterno' . $i], $_POST['txtNombre' . $i], $_POST['txtPuesto' . $i]); //registra adjunto de identificacion oficial del representante if (!empty($_FILES['idenRep' . $i]['name'])) { $adjuntos->guardarArchivo('idenRep' . $i, $m); $exped->regAdjuntosRepPMS($_FILES['idenRep' . $i]['name'], $repre, $_POST['cbmIdenRep' . $i]); } else { $exped->regAdjuntosRepPMS('sin adjunto', $repre, $_POST['cbmIdenRep' . $i]); } //registra el poder notarial del representante if (!empty($_FILES['idenRep' . $i]['name'])) { $adjuntos->guardarArchivo('adjPoderRepr' . $i, $m); $exped->regAdjuntosRepPMS($_FILES['adjPoderRepr' . $i]['name'], $repre, 39); } else { $exped->regAdjuntosRepPMS('sin adjunto', $repre, 39); } } //registra adjunto de domicilio if (!empty($_SESSION['comproDom']['name'])) {
function onupfilesave() { require_once admin_ROOT . '/public/class_upload.php'; $temppath = $this->fun->accept('path', 'P'); $path = admin_ROOT . $temppath; if (!$this->fun->filemode($path)) { exit($this->lng['filemanage_js_upfile_no']); } $amid = $this->fun->accept('amid', 'P'); $isamid = $this->fun->accept('isamid', 'P'); $title = $this->fun->accept('title', 'P'); $lng = $this->fun->accept('lng', 'P'); if ($isamid) { if (empty($title)) { exit($this->lng['download_mess_size_err6']); } $db_table = db_prefix . 'album_images'; $date = time(); $db_field = 'pid,lng,title,content,pic,addtime,isclass,istop'; $db_values = "50,'{$lng}','{$title}','{$title}','',{$date},1,0"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')'); $amid = $this->db->insert_id(); } $upfilepath = $this->fun->accept('upfilepath', 'P'); $img_issmallpic = $this->fun->accept('img_issmallpic', 'P'); $img_issmallpic = empty($img_issmallpic) ? 0 : $img_issmallpic; $img_width = $this->fun->accept('img_width', 'P'); $img_width = empty($img_width) ? 0 : ceil($img_width); $img_height = $this->fun->accept('img_height', 'P'); $img_height = empty($img_height) ? 0 : ceil($img_height); $img_issmallpic = $img_width < 1 || $img_height < 1 ? 0 : $img_issmallpic; $img_iswater = $this->fun->accept('img_iswater', 'P'); $img_iswater = empty($img_iswater) ? 0 : $img_iswater; $type = $this->fun->accept('filetype', 'P'); $type = empty($type) ? 'img' : $type; $dirdate = $this->fun->accept('dirdate', 'P'); $dirdate = empty($dirdate) ? $this->CON['img_dirtype'] : $dirdate; $filenametype = $this->fun->accept('filenametype', 'P'); $filenametype = empty($filenametype) ? $this->CON['img_cfiletype'] : $filenametype; $iszoom = $this->fun->accept('iszoom', 'P'); $iszoom = empty($iszoom) ? $this->CON['img_iszoom'] : $iszoom; $filename = $_FILES['upfilepath']['name']; $filesize = intval($_FILES['upfilepath']['size']); $filetmpname = $_FILES['upfilepath']['tmp_name']; $fileerror = $_FILES['upfilepath']['error']; $filetype = $_FILES['upfilepath']['type']; if ($filesize <= 0 || $filesize > intval($this->CON['upfile_maxsize'])) { exit($this->lng['download_mess_size_err2']); } $upfile = new uploadFile(); $filename = $upfile->upfilebase($img_width, $img_height, $img_issmallpic, $img_iswater, $path, $filename, $filesize, $filetmpname, $fileerror, $filetype, $type, $dirdate, $filenametype, $iszoom); if ($filename) { $db_table = db_prefix . 'filename'; $date = time(); $filename = str_replace(admin_ROOT, '', $filename); list($uploadfile, $toImagesFile, $outfiletype, $filepath, $iswidth) = explode('|', $filename); if (!empty($uploadfile)) { $db_field = 'username,filetitle,filename,filetype,filepath,addtime,iswidth'; $db_values = "('{$this->esp_username}','','{$uploadfile}','{$outfiletype}','{$filepath}',{$date},{$iswidth})"; if ($toImagesFile) { $db_values .= ",('{$this->esp_username}','','{$toImagesFile}','{$outfiletype}','{$filepath}',{$date},{$iswidth})"; } $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES ' . $db_values . ''); if ($amid && $outfiletype == 'img') { $insert_id = $this->db->insert_id(); $db_table = db_prefix . 'album_file'; $db_field = 'amid,fiid,filetitle,filedes,filename,filepath,iswidth,addtime'; $db_values = "({$amid},{$insert_id},'{$uploadfile}','','{$uploadfile}','{$filepath}',{$iswidth},{$date})"; if ($toImagesFile) { $db_values .= ",({$amid},{$insert_id},'{$toImagesFile}','','{$toImagesFile}','{$filepath}',{$iswidth},{$date})"; } $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES ' . $db_values . ''); } } } if ($uploadfile) { if ($toImagesFile) { exit($filepath . $uploadfile . '|' . $outfiletype . '|' . $iswidth . '|' . $filepath . $toImagesFile); } else { exit($filepath . $uploadfile . '|' . $outfiletype . '|' . $iswidth . '|'); } } else { exit('false'); } }
while (!feof($gcomm)) { $line = fgets($gcomm); if (trim($line) != "") { if (strtolower(str_split($line, 10)[0]) == "@attribute") { $value[] = "attribute" . $i; $i++; } } } fclose($gcomm); return $value; } function addfieldCSV() { $gcomm = fopen($this->getFilePart() . $this->getFileName(), "r"); $value = array(); while (!feof($gcomm)) { $line = fgets($gcomm); if (trim($line) != "") { foreach (explode(",", $line) as $k => $v) { $value[] = "attribute" . $k; } break; } } fclose($gcomm); return $value; } } $up = new uploadFile(); $up->upLoadFileNow();
<?php require_once 'classes/uploadFile.php'; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> </head> <body> <?php if (!empty($_FILES)) { uploadFile::MultiUpoad($_FILES, false); } else { echo "<h1>No ha llegado ningin fichero</h1>" . error_get_last()['message']; } ?> </body> </html>
<?php require_once '../classes/Autoload.php'; $session = new Session(); if (Request::post('categoria') !== null) { $usuario = $session->get('user')->getUserName(); $categoria = Request::post('categoria'); if (Request::post('privado') !== null) { $privado = "P"; } else { $privado = "A"; } if (isset($_FILES['cancion'])) { $cancion = new uploadFile($_FILES['cancion']); $nombre_tipado = $privado . '_' . $usuario . '_' . $categoria . '_' . $cancion->getName(); if ($cancion->getError() === UPLOAD_ERR_OK && $cancion->getExt() === "mp3") { $cancion->setName($nombre_tipado); if (!$cancion->upload()) { echo "<h2>Error: " . $cancion->getError_message() . "</h2>"; echo $cancion; } else { echo "<h2>Error: " . $cancion->getError_message() . "</h2>"; } } else { echo "<h2>No ha llegado ninguna cancion: " . $cancion->getError_message() . "</h2>"; } if (isset($_FILES['img'])) { $imagen = new UploadFile($_FILES['img']); if ($imagen->getError() === UPLOAD_ERR_OK && $imagen->getExt() === "jpg") { $imagen->setName($nombre_tipado); if (!$imagen->upload()) {
<?php include_once "../helper/uploadFileClass.php"; include_once "../controller/cExpediente.php"; $upload = new uploadFile(); $expe = new cExpediente(); print_r($_POST); $nvoDocto = $upload->guardarArchivo('nvoDocto', $_POST['idclte']); $expe->actualizaAdjunto($_POST['id_ad'], $nvoDocto, $_POST['idadjunto'], ""); $nvoDocto = $upload->deleleFile($_POST['nombre_archivo'], $_POST['idclte']); header("Location: ../view/listarExpediente.php");
/** * Metodo steatico para subir un archivo * @param array $file Datos del archivo (requerido) * @param String $dest Ruta de subida (opcional) * @param int $max_size Tamaño máximo del archivo (opcional) * @return boolean | string True si todo correcto o el mensaje de error en caso contrario */ public static function loadFile($file, $dest = null, $max_size = null) { $new = new uploadFile($file, $dest, $max_size); return $new->upload(); }