开发者

How to handle input type=file in Jquery while uploading file?

I searched a lot. Eve开发者_JS百科ry time anyone asked about file uploading by jquery, as answers he got only some links of jquery plugin. Can anyone tell me why plugin is needed? why simple ajax is not working in this context?

Tuition is preferable than solution.


You can only upload files by posting the form that contains the file input. You can't upload files using AJAX.

The reason for this is security. A user can select a file to be uploaded, but the only thing that the Javascript code can do is to upload the file using a post, it can't access the file data or upload it any other way.


$("input[type='file']").hide();

will hide input with file type.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜