DescriptionNode.js is a wonderful technology to build lightweight HTTP servers and using it to receive uploads is a great idea. That's why we decided to provide a sample application how to create upload server to accept uploads made with Upload Suite using Node.js.
Where to get it?It is available in the
npm repositary. Just type this string in the command prompt and run it:
npm install aurigma-uploader-sampleAlternatively, you can download the .zip folder attached to this post.
StructureThere is a single .js file called
aurigma-server.js and
aurigma folder which contains Upload Suite's binaries and scripts. The uploader itself is loaded on the index.htm page.
The aurigma-server.js recognizes the following URLs:
1. Any static content like
htm,
css, images,
cab,
jar, etc.
2.
/upload - it receives the POST request.
3.
/gallery - it displays the content of the
gallery folder.
How it works1. By default, index.htm is loaded. This page contains the uploader.
2. The user selects some images and clicks Upload.
3. As a result, images are sent to the /upload URL which processes the POST request and saves all images with their thumbnails to the gallery folder (on the same level with aurigma-server.js). If this folder does not exist, the server automatically creates it.
4. When the upload completes, the user is forwarded to the /gallery page.
CommentsThis sample is intentionally very simple and I tried to minimize the usage of external modules and template engines. There are only two modules are used:
1.
formidable - to parse POST requests.
2.
xml - to generate HTML code to display the gallery.
If you have any questions/suggestions regarding this sample, don't hesitate to post your questions here.
Edited by user Wednesday, October 2, 2013 4:10:04 AM(UTC)
| Reason: Not specified