Why Ajax cannot submit attachments

Source: Internet
Author: User

Ajax is based on JavaScript, while JS cannot operate for security reasons.CompositionTherefore, Ajax cannot directly upload attachments. You can use other workarounds.
However, Ajax submission is based on the HTTP protocol. It can also be divided into get and post submission methods. You can put the Form Content in the message body, which is similar to form. the submit () is the same. Why is form used. submit () can process attachments, but Ajax cannot?

 

Q: How do you use js to read client files ?? Permissions must be obtained from Javascript. js cannot operate files for security reasons.

When a file is submitted using the form input control, the obtained client content isBrowserRather than Js.

 

The browser is responsible for reading local files, and the JS written by the developer reads local files. For security reasons, the latter obviously has no permissions.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.