Sunday, September 22, 2013

Upload File using jQuery-File-Upload

Original Code

https://github.com/blueimp/jQuery-File-Upload

My Work


This is cool jQuery library which allows the user to upload their files with cool interface. It also support "drag & drop", so it's much faster for people to select files. However, security may be a big issue in this case.

Problems I Met & How I Solved Them


Error, unable to upload the file

Solving this problem by giving right permission to the folder which the website is going to save files (in the example code, it's ./server/php/files). Make sure that "www-data" is able to "write" the folder.


The thumbnails are not showing up

I directly type in the URL of the thumbnails, and the browser showed a message asked me to read the error log file. In the log file, it says:
Invalid command 'Header', perhaps misspelled or defined by a module not included in the server configuration, referer: http://heron.nctucs.net/upload/index.html
So, here my solution from this website:
ln -sf /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load