nlt-pagoda/pagoda-scratch — pull request #17 by sinkingshriek (2012-02-22 20:37:27+00:00)
Title: Working Upload feature.

After countless errors and headaches, I have finally managed to make this upload feature work. It still hasn't been fully integrated with the main site though I am just waiting on our new Render function. After our new render we should be able to integrate it with our main site.

For now you can play with the upload function by first logging in and then on the location bar by typing:-
http://localhost/pagoda-scratch/view/upload/upload.php

**This will generate a folder called /uploads on pagoda-scratch/ and based on who the user is creates a folder on his/her name and uploads the file under that directory.

If files already exist in that directory then user is asked whether to replace the old file with new one (this part gave me lot of headache. I tried doing absolutely everything I could to make it work seamlessly but due to restriction between php and javascript I failed at doing so. So I did the second best thing.

If file already exists then a tmp/ directory is created under the username's folder and files are uploaded to there instead. User are asked whether to replace the old file with the new one and then files that were in tmp/ folder is then copied to the user's folder and tmp/ folder is deleted.

I have yet to test the replace file feature with the legit files(by actually changing the content of the file) but so far I think it works but I could be wrong as it happened to me so many times when I was working with this.

===Folder created===
/include //Currently this folder has external javascript files but will change in the future

Also, I haven't yet implemented the absolute path. I am still implementing the relative path, the reason being that it was easier for me to implement this way for now. This will probably change when we push it to our live site.