Skip to content

Instantly share code, notes, and snippets.

@srinivas69
srinivas69 / app.js
Created June 18, 2020 16:34
Expressjs & EJS Tutorial to Choose and Upload File-Nodejs complete code
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const formidable = require('formidable');
const fs = require('fs');
const app = express();
const port = 3000;
// configure middleware
app.set('port', process.env.port || port); // set express to use this port
app.set('views', __dirname + '/views'); // set express to look in this folder to render our view
@srinivas69
srinivas69 / app.js
Created June 18, 2020 16:33
open index ejs api
app.get('/', open_index_page);//call for main index page
function open_index_page(req, res, next){
if(req.method == "GET"){
res.render('index.ejs');
}
}
@srinivas69
srinivas69 / index.ejs
Last active June 18, 2020 16:32
upload file html view
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Upload File Tutorial</title>
</head>
<body>
<div class="container col-sm-12" id="choose-files" oncopy="return false" oncut="return false" onpaste="return false">
<div class="row">
@srinivas69
srinivas69 / app.js
Created June 18, 2020 16:29
upload file nodejs api
const path = require('path');
const formidable = require('formidable');
const fs = require('fs');
//upload file api
app.post('/uploadfile',upload_file);
function upload_file(req, res, next){
if(req.method == "POST") {
// create an incoming form object
@srinivas69
srinivas69 / app.js
Created June 18, 2020 16:27
create nodejs server
const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const app = express();
const port = 3000;
// configure middleware
app.set('port', process.env.port || port); // set express to use this port
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store