Well, i guess i'm feeling Hot today ;)
Two posts within 24 hours, wow... lol
Well, i've been working on a project and was looking for an existing Image uploader that uses AJAX, knowing in advanced that really it's impossible (except for FF) to use xmlHTTPRequest, i was looking for a solution that uses iFrame, while googling it, it wasn't hard to come up with Asynchronous image file upload without AJAX by Martin Konicek. So i went ahead and downloaded it. After setting it up the first time, i got real bugged that it supported only Jpeg, when you'd upload something otherwise, it will just show an X instead of the image, that is not acceptable when you are creating a system for a client. Unless you want to give him a "Do not do" list for your product.
So i started playing with the code, while reading through, found out some really annoying stuff and fixed it according to my ideology. Unfortunately while doing that i didn't know i will actually re-release the code, so i didn't comment out all the changes i've made, but the most major ones are:
Support for JPEG,GIF,WBMP and PNG. (All credit goes to Huda M Elmatsani which class i used to do the conversion 'i.e had to modify that script as well').
The script doesn't throw an error in FF saying that it can't work out the setTimeOut.
The script doesn't trying to read the uploaded file information when no file has been uploaded, and is not trying to upload a file when the uploaded file field is empty.
These are the major changes to the script. Again, all credit goes to the creators of the script, All i did is modified it to my needs and hopefully it will serve any of you too.
For the sake of it, i renamed the script to Asynchronous image file upload without AJAX + PLUS so people will be able to distinguish between the two.
The script can be downloaded in the following link. Unfortunately i had to upload it to Rapidshare, if any of you is willing to host it on their servers, i'll be very thankful.
Till next time....