Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
The new infusion uploader demo to replace the old image gallery.
tree: ec37cf2fcd

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
css
include
js
README
install.sh
uploader.html
uploader.php

README

How to install:
1. First of all, make sure you have PHP, Apache (or other web servers) and git installed. Moreover, infusion library is pulled out locally.

2. Retrieve image gallery demo and install:
   cd [webserver_document_root]         -- or any folder underneath your web server document root
   git clone git://github.com/cindyli/image-gallery.git
   cd image-gallery
   
   ./install.sh        -- Note that install.sh asks for the path to your local infusion library

3. That's all. Now access via (just an example): http://localhost/image-gallery/uploader.html

How it looks like:
This image gallery uploader demo is composed by 2 parts: the multi-file uploader at left and an image viewer at right. 

The work flow:
1. When "upload" button is clicked: the html page sends the upload request to the server along with a session token. This session token is a unique 13-character string that is generated by front-end javascript. It helps the php server to distinguish the upload requests from different clients. 

2. Once the PHP server receives the uploaded image, it looks up in the "temp" directory for the sub-directory that is named after the sent-in session token. If the sub-directory does not exist, creates a new. The uploaded images are placed into the sub-directory, then the server sends back the url of the uploaded image. The client retrives the url and adds it to the image viewer. 

3. If anything goes wrong at PHP server, for instance, no file is received, session token is not provided, invalid file extension, or temp/ folder does not exist, the server returns a error message with http status code 400. The client displays the error on the page along with the name of the corresponding file.

A few constraints performed at PHP server:
1. Removes the temporary folder created for each session that are inactive for over an hour. This is performed in uploader.php as the first thing whenever it's called.

2. For security reason, the server only allows the upload of these file types: jpg, jpeg, gif, png, tif, tiff

3. Rejects the same file that has already been uploaded.
   
Questions:
1. in uploader.html, line 37, "styles.css" is linked in at "the uploader demo" section, should it be moved to the top of the script to be together with other .css
Something went wrong with that request. Please try again.