Example #1
0
    $str .='local TEMP dir: "' . getenv('TEMP') . "\"\n";
    $str .='upload_max_filesize: "' . ini_get("upload_max_filesize") . "\"\n";
    $str .='post_max_size: "' . ini_get("post_max_size") . "\"\n";
    return $str;
}

////////////////////////////////////////////////////////////////////////
// show debug information
 echo nl2br(debug()) . "<br>"; 

// only images
$allowedTypes = array("image/bmp","image/gif","image/pjpeg","image/jpeg","image/x-png");
$uploadPath = 'c:/temp';
$overwrite = true;

$up = new OOB_fileupload();
 if (wasSubmitted('_uploaded')) {
    // files were submitted
    echo dumpAssociativeArray($up->upload($uploadPath, $overwrite, $allowedTypes));
 //display form
 } else {
?>
<form action="http://localhost/eclipse/oob/oob/test/fileupload_test.php" method="post" enctype="multipart/form-data">
  <p>
  <input name="archivoa" type="file" size="10">
    <input name="_uploaded" type="hidden" value="true">
  <br>
  <input name="archivob" type="file" size="10">
  </p>
  <p>
    <input name="ok" type="submit" value="ok" >
Example #2
0
}
//nuevo
if (count($_POST)) {
    $foto = false;
    $mensaje = false;
    // tenemos 3 casos
    // solo mensaje
    // solo foto
    // las dos cosas.
    $mensaje = new perfil_mensaje();
    $mensaje->set('perfil', $perfil);
    $mensaje->set('fecha', new Date());
    if ($_POST['mensaje'] != '') {
        $mensaje->set('mensaje', $_POST['mensaje']);
    }
    $up = new OOB_fileupload("file");
    if ($_FILES['file']['name'] != '') {
        $allowedTypes = array("image/gif", "image/pjpeg", "image/jpeg", "image/x-png");
        $uploadPath = $ari->get('filesdir') . DIRECTORY_SEPARATOR . 'archivos' . DIRECTORY_SEPARATOR . 'fotos';
        if ($upload = $up->upload($uploadPath, false, $allowedTypes, $perfil->get('id') . '_' . time(), true)) {
            $mensaje->set('foto', $upload['name']);
            //$mensaje->set('exif',exif_read_data($upload['full_path'])); // no anda don exif!
        }
    }
    if ($_POST['mensaje'] == '' && $_FILES['file']['name'] == '') {
        $mensaje->error()->addError('NO_MENSAJE');
    }
    if ($mensaje->store()) {
        header("Location: " . $ari->get('webaddress') . '/perfil/perfil/mio');
        exit;
    }