post.php (1404B)
1 <html> 2 <head> 3 <title>Submit a new blog entry</title> 4 </head> 5 <body> 6 7 <?php if ( !empty($_POST['text']) ) { 8 9 require('/home/dankert/Entwicklung/Queue/FileQueue.class.php'); 10 11 $value = array(); 12 13 $value['text'] = $_POST['text']; 14 15 $value['title'] = $_POST['title']; 16 17 18 if ( !empty($_FILES['image']) ) 19 { 20 $files = array( $_FILES['image']['tmp_name']); 21 $value['files'] = array('filename'=>$_FILES['image']['tmp_name'],'name'=>$_FILES['image']['name'],'content'=>base64_encode(file_get_contents($_FILES['image']['tmp_name']))); 22 // $files = array( $_FILES['image']['tmp_name'],$_FILES['image']['name']); 23 } 24 25 $queue = new FileQueue(); 26 $queue->directory = './queue/fileupload'; 27 28 $entry = new QueueEntry(); 29 $entry->files = $files; 30 $entry->value = $value; 31 32 $entry->push(); 33 34 ?> 35 <h3>Saved!</h3><a href="blog.php">Start push to server now...</a><?php } 36 ?> 37 38 <h1>Blog</h1> 39 <form enctype="multipart/form-data" action="<?php echo $_SERVER['SCRIPT_NAME'] ?>" method="post"> 40 41 <div class="line"> 42 <div class="label">Titel</div> 43 <div class="value"><input type="text" name="title" value="" /></div> 44 </div> 45 <div class="line"> 46 <div class="label">Text</div> 47 <div class="value"><textarea name="text"></textarea></div> 48 </div> 49 <div class="line"> 50 <div class="label">File</div> 51 <div class="value"><input type="file" name="image"></input></div> 52 </div> 53 54 55 <br> 56 57 <input type="submit"></form> 58 <hr> 59 60 </body> 61 </html>