2

Hey guys I'm trying to implement file upload on my site without refreshing the page. I don't want something like iFrame is there any other way to do this in ajax? I've tried though (USING Codeigniter & ajax but it outputs "You have not uploaded anything"). I've read certain pages like this one but I couldn't seem to implement it properly. Any suggestions guys? I read almost all suggestions posted here using jquery ajax but they are all not good. I just want pure jquery ajax nothing else.

If its not possible, iframe could do please share some examples. :)

Note: This is only good for one upload at a time. No multiples.

6 Answers 6

4

Instead of reinventing a whole thing from a scratch, I would use one of the file upload components.

  1. Plupload - has UI, integrates nicely with jQuery. Depending on browser can use HTML5, Flash, Silverlight or HTML4
  2. Swfupload
  3. Uploadify
Sign up to request clarification or add additional context in comments.

10 Comments

plupload has pure HTML5 and you can disable Flash module
But some web browsers don't support html5. Especially IE
Plupload detects which features available in user's browser. For older browsers there is HTML4 fallback
@PeterWateber Plupload is very good and completely customisable : number of files allowed, types of file, runtimes availables, etc. Just give it a try !
I've used it also in a number of projects with .NET and Python backends, so it's definitely worth its 10 Euro licensing fee :-)
|
0

there is no AJAX file upload. Its all iFrame behind the curtain when it comes to file upload. The example link you gave does not do any magic but it uses hidden iFrame.

5 Comments

How does facebook do it then? I've seen the code I couldn't find iframe
@peter not sure if Facebook changed but it used java applet at one point.
if it creates hidden iframe at runtime, how do you think you will see it?
There is HTML5 File API and XHTTP request (a.k.a AJAX)
You are wrong. The XMLHttpRequest Level 2 adds support for the new FormData interface which allows AJAX upload of files. Here is a reference.
0

Many Answers can be found here: How can I upload files asynchronously?

This question may be a duplicate to the above

Ref: "There's various ready-made plugins on doing file upload on jquery.

Doing this kind of uploading hacks is not an enjoyable experience, so people enjoy using ready-made solutions.

Here's few: http://www.phpletter.com/Demo/AjaxFileUpload-Demo

http://www.fyneworks.com/jquery/multiple-file-upload

Ajax File Upload Plugin Multiple File Upload Plugin You can search more from jquery's plugin -site."

1 Comment

actually I've already tried the first one.. the second once I guess I couldn't understand lol
0

From pure ajax it is not possible, you can use this ajax form plugin and it will be handle all things (create iframe automatically for input type file)

Comments

0

I have tried many, many plugins for a project in the past, and I came to the conclusion that I liked none of them. Well, except this one: jQuery-file-upload In my experience this is easily the best plugin out there for handling file upload.

Comments

-1

According to my knowledge there has to be a server side programming language such as php. Try this out. http://valums.com/ajax-upload/

3 Comments

you do have to write server-side handler to save the file somewhere.
Obviously you need something on server side to handle your uploaded data :-)
Broken link (404)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.