Forum Moderators: open

Message Too Old, No Replies

How to get File array using ajax?

using POST method

         

Rose

8:44 am on Apr 11, 2009 (gmt 0)

10+ Year Member



Hi,

I am having muiltiple image upload form.Now I want to upload images without referishing page and show progress bar as well.I am new to ajax. I am able to get other fields using post menthod , but unable to get file array to upload the file. I tried lot of examples form net.If anyone can help me out.Its urgent.

blang

12:58 pm on Apr 11, 2009 (gmt 0)

10+ Year Member



Hi Rose, welcome to the forums.

First and foremost, it's not urgent. Delivering a baby is urgent. Having surgery to avoid a ruptured appendix is urgent. This is JavaScript.

Secondly, you can't upload files using "Ajax", not strictly speaking. The security model built into JavaScript / XMLHttpRequest doesn't allow it. You can use an iframe [google.com], or you can use one of the Flash alternatives such as implemented in YUI's "uploader" component [developer.yahoo.com].

whoisgregg

5:57 pm on Apr 17, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, Rose!

If the browser allowed javascript access to the file upload form, malicious scripts could use that information to browse through users hard drives, checking for the existence and/or file size of different paths.

As blang pointed out there are solutions. A search in your favorite search engine for "ajax file upload" or something similar will give you plenty of choices. :)