Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Andrew  
#1 Posted : Wednesday, October 2, 2013 4:04:23 AM(UTC)
Andrew

Rank: Advanced Member

Groups: Member, Administration
Joined: 8/2/2003(UTC)
Posts: 868

Thanks: 2 times
Was thanked: 26 time(s) in 26 post(s)
Description

Node.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-sample

Alternatively, you can download the .zip folder attached to this post.

Structure

There 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 works

1. 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.

Comments

This 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

File Attachment(s):
aurigma-uploader-sample.zip (8,468kb) downloaded 26 time(s).
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.