コード例 #1
0
ファイル: photo_upload.php プロジェクト: philipos/Fishki-2010
if (isset($_POST['submit'])) {
    $photo = new Main_pictures();
    $photo->head = $_POST['head'];
    $photo->readmore = $_POST['readmore'];
    $photo->comid = $_POST['comid'];
    $photo->attach_file($_FILES['file_upload']);
    if ($photo->save()) {
        // Success
        $session->message("Photograph uploaded successfully.");
        redirect_to('list_photos.php');
    } else {
        // Failure
        $message = join("<br />", $photo->errors);
    }
}
$coms = Main_pictures::find_com();
?>

<h2>Photo Upload</h2>

<?php 
echo output_message($message);
?>
<form action="photo_upload.php" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php 
echo $max_file_size;
?>
" />
<p><input type="file" name="file_upload" /></p>
<br />head: <textarea name="head" cols="30" rows="3"> </textarea> 
<br /><br />Readmore: <textarea name="readmore" cols="30" rows="10"> </textarea>