1.0.7 • Published 7 years ago

uploadnode v1.0.7

Weekly downloads
2
License
ISC
Repository
-
Last release
7 years ago

Synopsis

This is a module that you can install so you can upload file you need only the basic. With a simple html an js file you can upload your file where you like. I use the lib from the express-fileupload. And around of that i make a simple module.

Installation

you open your terminal and you type:

The Express lib:

npm install --save express

The express-fileupload lib:

npm install express-fileupload

And the the module to make it simple to use.

npm install uploadnode

Motivation

I love to code and help other.

Reference

I use the: NodeJs express This is the main code that work is from richardgirges with the best express-fileupload

Tests

You call the module:

var uploadModules = require('uploadModule/upload');

I use the ejs JavaScript Templates. for this module. For the form you make a action="fileUpload" this is the url to send to find in the server side. In that case in NodeJs further down you can see the post from the nodejs.

<form action="fileUpload" method="post" enctype="multipart/form-data">
    <input type="file" name="fileToUpload" /> <!-- This is the name you  are calling the file. -->
    <input type="submit">
</form>

Then you only need to pass the var='/upload' is where the folder sold be to insert the file you upload. So be sure to make a folder so the file have a place to be. Check to make sure that the directory i correct for your app.

app.post('/fileUpload',function (req,res) {
    var fileFromAction = req.files.fileToUpload; //this is the name that pass the form the name field.
    var url = 'upload/';  

    uploadModules.upload(req, res, fileFromAction ,url);

});

If you like to use a render to a tamplete you can use this code.

app.post('/fileUpload',function (req,res) {
    var fileFromAction = req.files.fileToUpload;
    var url = 'upload/';
    var renderOn = 'index';

    uploadModules.upload(req, res, fileFromAction ,url, renderOn);

});

Contributors

Let people know how they can dive into the project, include important links to things like issue trackers, irc, twitter accounts if applicable.

License

ISC

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago