Jump to content
Sign in to follow this  
Andrew K.

AJAX Upload File

Recommended Posts

Okay so I've been looking around and I noticed AJAX upload file doesn't exactly exist.Is there an alternative method besides iFrames? Would I be able to use *insert server side language here*AJAX?

Share this post


Link to post
Share on other sites

You could use PHP combined with AJAX to upload a file, so that when you click "submit" on a form it posts the file details from a file input via AJAX to a PHP script that uploads the file...

Share this post


Link to post
Share on other sites

I've never successfully uploaded a file using AJAX. Anyone have any sample code?

Share this post


Link to post
Share on other sites

Are you both talking about CFAJAX or just regular AJAX? Because I think you're both talking about normal Ajax and I keep reading that it's impossible.

Share this post


Link to post
Share on other sites
http://digg.com/programming/Use_Ajax_To_Upload_Filesit not done completely through AJAX but needs some help from an iframe it still achieves the same end.This (http://www.captain.at/ajax-file-upload.php) however is pure AJAX upload, mind you it only works in Firefox and requires a bit of tweaking by the user but it would be a suitable solution for a closed intranet or software backend.

Share this post


Link to post
Share on other sites

Javascript is not able to read a file on your local computer, it would need to do that in order to upload it to the server. It is a major security hole if Javascript is able to read your files.The code on the captain.at site opens such a security hole in Firefox. Apparently the Firefox developers thought it would be a good idea if they made a setting that allows Javascript to read local files, and that is what the code takes advantage of. Following the instructions on that page to enable that option leaves your computer open to having any file read and sent to any server if you are using Firefox.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...