hi I know pretty much about HTML-PHP form building. But I am new to jQuery.
My Question is : Is it safe to use jQuery instead of HTML to upload files in a form?
I mean the security of the form.
Is it safe to use something like h开发者_如何学JAVAttp://www.uploadify.com instead of HTML-PHP to upload images like avatars in a public website?
What precautions should I make?
There is no issue using jQuery to help with uploads on your site. If you are looking at something like Uploadify, you should note this information on their About page:
Uploadify is a jQuery plugin that integrates a fully-customizable multiple file upload utility on your website. It uses a mixture of Javascript, ActionScript, and any server-side language to dynamically create an instance over any DOM element on a page. [emphasis mine]
It is impossible to use pure JavaScript to upload a file due to security concerns, so, ultimately, you will be hitting server-side code at some point. And, as always, you should always perform security checks and validations server-side to ensure that everything is safe.
Don't get confused, you apply the same techniques in any case (the Browser transmitting a form/file) The only difference is if you do it "normal" or via jQuery using a asynchronous Browser Call, the safety Options you have are exactly the same, only the methods vary.
精彩评论