简体   繁体   中英

Basic Javascript + PHP Ajax File Upload

Despite there are numerous articles on AJAX file uploading on StackOverflow.com, I did not find a complete and pure JavaScript AJAX uploader.

Many of them involve JQuery, another are asp.net based, another say, pure JavaScript based AJAX file upload is not possible because of security issues.

I searched internet too, but it seems to be very difficult finding a complete and clean JavaScript AJAX example, with PHP script on the server side.

Can I kindly ask, to provide me with as simple as possible, but functional and clean JavaScript AJAX file upload? I do not wish to include Drag and Drop functionality but these technologies may be used:

  • HTML5
  • JavaScript but no JQuery
  • PHP
  • type="file" input filed
  • no demos please , I just wish to have a code I can further modify on my own

Maybe, you will find the right example even on StackOverflow.com. If yes, then I do apologize for not finding it as well. However, I definitely did my homework and did the search. Thank you.


Alexander has just pointed out that this question is bad, because it requests for a code sample. Well, the last think I wish is getting this question closed, because of wrong interpretation.

If you wish, provide me with a tutorial, that talks about this subject, or tell me about a book that contains the answers. I am writing my application, and I did not yet pollute it with any libraries, neither JQuery. I would like to keep it so, as long as it is possible.

The answer is yours, and you can formulate it in the way you feel it is appropriate. You can avoid providing code, if you think, it is wrong to do it.

There are two approaches you can take.

  1. Submit a form to a hidden iframe (better supported)
  2. Use the File API (more powerful)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM