var express = require('express')
var router = express.Router()
var session = require('express-session')
const MongoStore = require('connect-mongo')
require('dotenv').config()



router.use(session({
  secret: process.env.SECRET_KEY,
  resave: false,
  saveUninitialized: false,
  store: MongoStore.create({ mongoUrl: process.env.DATABASE_URI })
}))

const loginRoute = require('./users/login')
router.use('/', loginRoute) 

const postRoute = require('./users/post')
router.use('/post', postRoute) 

const categoryRoute = require('./users/category')
router.use('/category', categoryRoute) 

const pageRoute = require('./users/page')
router.use('/page', pageRoute) 

const bookRoute = require('./users/book')
router.use('/book', bookRoute) 

const uploadRoute = require('./users/upload')
router.use('/upload', uploadRoute) 



module.exports = router

 

const express = require('express')
const fileUpload = require('express-fileupload')
var router = express.Router()
var settings = require('../../settings')



router.use(fileUpload())

router.get('/', async function(req, res){
    settings.dLogo = 'ទំព័រ​ Upload'
    settings.message = ''

    if(req.session.user){
        res.render('users/upload', settings)
    }else{
        res.redirect('/users')
    }
})



module.exports = router

 

<%- include('partials/header.ejs') %>
<link href="/styles/users/category.css" rel="stylesheet"></link>
  
<section class='Main region'>
    <div class='sidebar'>
        <%- include('partials/menu.ejs') %>
    </div>

    <style>
        .Main .content form input{
            padding: 3px 0;
        }
        .Main .content form input[type=text]{
            text-align: center;
            font: var(--body-fornt);
        }
    </style>

    <div class='content'>
        <form action='/users/upload' method='post' enctype="multipart/form-data" >
            <a></a><input type='file' name='uploadFile' required />
            <a></a><input type='text' value='<%= message %>' placeholder='តំណរភ្ជាប់ឯ​កសារ​នៅ​លើ Server' />
            <a></a><input type='submit' value='បញ្ជូន​ទិន្នន័យ' />
        </form>
    </div>
</section>


<%- include('partials/footer.ejs') %>

 

GitHub: https://github.com/Sokhavuth/tv

Vercel: https://tv-neon.vercel.app

Responsive: http://www.responsinator.com