« Harry Fuecks talking about AJAX and how it sucks | Main | AJAX, Systems Theory and Climate Change »

AJAX Files Uploader PHP class

I was looking for a solution to upload files using AJAX few months ago, the feature I saw it then in Gmail but didn't find a solution to do it. I just find a solution today, AJAX File Uploader allow to upload files using AJAX methods, now you'll be able to send files without reloading the page. There is auxiliary Javascript code that can upload in the background a file that the users chooses in a Web page form and updates the upload message status in the page. A server side auxiliary script gets the uploaded files and copies to an upload directory.

http://ajax.phpmagazine.net/upload/2006/01/gmail-upload-thumb.png

The script have been written for PHP5, if you want to use it for PHP4 you need to make some changes and replace "PRIVATE" with "VAR" in the AjaxFileuploader class, and remove "PUBLIC", "PRIVATE" and "PROTECTED" keywords before the functions. An excellent example to make AJAX forms now able to send all kind of data even binaries.

Bookmark this article at these sites
Comments
1

Good solution if you use only localhost. Don´t work in server because:

line 21 (uploader.js)
http.open('get', 'imageupload.php?uploadFile='+fileName+'&destination='+destinationPath);

this will copy a local file to oder folder, but if the client is different of server don´t work, cause the file is not "UPLOAD" to server.

2

I would highly recommend for the original author a book called "Learn to Speak English for Dummies"

3

Also :
"Good solution if you use only localhost. Don´t work in server because:"

1) he is from india, so he probably stole the code from someone else.

2) the code is poorly written, so it would take breaking apart to have this work for anyone.

3) when you read a post and the logic behind the statements made don't exactly make sense, then the best solution is to not use the code. otherwise you get the problems you are having..

4

Everybody knows that sometimes we think we've found a good solution, but later on finds out that there are some bugs and discovers that the solution isn't so good...
This doesn't have relation with the nationality of the programar, because you Bob certainly made some erroneous code your self.
Keep programming and writting articles Er. Rochak Chauhan thats how we grow and learn in life

5

Hi guys,
I'd like to inform you that I have developed a AHAH Image Uploader. What do u think about?

http://www.gizax.it/experiments/AHAH/uploader/

regards,

Daniele
http://www.gizax.it

6

bob..... it's funny because your name spelled backwards is .... bob
get a real name bob.

7

hi

8

Bob,

You suck dude! I highly recommend a book called "Finding a good name for Dumb Bob". Read it and change your name. Your name totally sucks dude.

9

Bob,

Seeing the use of punctuation marks in your reply, I suggest you read the book first yourself.

Regarding the rest of your comments, all I can say is that if you were any good yourself, you would have written a better piece of code and made your point instead of choosing to pass stupid comments on somebody's nationality.

From next time, if you can't contribute positively to something, at least try to restrain yourself from passing stupid and immature comments.

Go, get a life...

10

Bob, I just want to say that mind and logic doesn't have any concern with the nationality. And if you are so much intelligent, then why are you westing time on finding the ready made code for you instead of writing your own code????

11

Your file hosting site is crap.

This is no good because I need a script that calls POST, not GET.

12

All these negative comments from people. Why dont you write your own code instead of bitching all the time.

Honestly, internet forums are full of whinging assholes

Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):