<?php
 
/**
 
 * Nweb Extension Script
 
 *
 
 * Example
 
 *
 
 * @category   Nweb
 
 * @package    Nweb_Scripts
 
 * @author     Krzysztof Kardasz
 
 * @copyright  Copyright (c) euo.pl
 
 */
 
 
 
    include 'lib/Image.php';
 
    include 'lib/ImageException.php';
 
    include 'lib/ImageUpload.php';
 
    include 'lib/ImageUploadException.php';
 
 
try {
 
 
    $upload = new ImageUpload();
 
 
    //Możemy objąć to w instrukcje if ale nie musimy.
 
    //Żadna akcja się nie wykona jeśli nie wyślemy formularza.
 
    $upload->upload(array('obraz','obraz2','obraz3'));
 
 
    // Na uploadowanych plikach możemy wykonywać różne operacje
 
    // Oprócz metody: save, compose i display
 
    // W metodzie Text argument Image automatycznie przyjmuje wartość null,
 
    // bezwzględu na to jaką mu podamy.
 
    $upload->ResizeToWidthHeight(300, 200)->GrayScale();
 
 
    #uploadSave ([string katalog docelowy,] [string nazwa pliku,] [boolean automatyczna zmiana nazw,] [int start numerowania])
 
    $upload->uploadSave ('uploads/','zdjecie',true);
 
 
    $Messages = implode('<br />', $upload->GetMessages ());
 
}
 
 
catch (ImageUploadException $e)
 
{
 
    die($e->Message());
 
}
 
 
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html>
 
<head>
 
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
 
<title>ImageUpload - 02</title>
 
</head>
 
<body>
 
<h3><?php echo (!empty($Messages)) ? $Messages : 'Upload zdjęć'; ?></h3>
 
<form enctype="multipart/form-data" action="" method="post">
 
<fieldset>
 
    <legend>Zdjęcia:</legend>
 
    <label>Obraz</label> <input name="obraz" type="file" /> <br />
 
    <label>Obraz2</label> <input name="obraz2" type="file" /> <br />
 
    <label>Obraz3</label> <input name="obraz3" type="file" /> <br />
 
</fieldset>
 
 <input type="submit" name="submit" value="Upload" />
 
</form>
 
 
</body>
 
</html>
 
 |