Файловый менеджер - Редактировать - /var/www/readzy/system/views/create.php
Назад
<?php use readzy\db; use readzy\AWS_S3; if(isset($_POST['form']) && $_POST['form'] == 'create'){ //Create SID $sid = 'B'.time(); $s3 = new AWS_S3(); //Upload cover to AWS if($s3->putObjectFile($_FILES['cover']['tmp_name'], $_ENV['aws']['bucket'], 'book/'.$sid.'/cover.jpg')) { //Upload data to AWS if($s3->putObjectString($_POST['data'], $_ENV['aws']['bucket'], 'book/'.$sid.'/data.txt')) { db::query("INSERT INTO books (sid, genre_id, title, words)VALUES(?,?,?,?)",[$sid, $_POST['genre_id'], $_POST['title'], 10]); }else{ die('Could not upload data'); } }else{ die('Could not upload cover'); } header("Location: /books"); die(); } ?> <form method="post" enctype="multipart/form-data"> <div>Book Title</div> <input type="text" name="title" /> <div>Book Cover</div> <input type="file" name="cover" /> <div>Book Content</div> <textarea name="data"></textarea> <input type="submit" name="submit" value="Add Book"/> <input type="hidden" name="genre_id" value="<?=$_GET['genre_id']?>" /> <input type="hidden" name="form" value="create" /> </form>
| ver. 1.4 |
Github
|
.
| PHP 7.0.33-0ubuntu0.16.04.16 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка