开发者

How to get the "value" of a upload input with jQuery

开发者 https://www.devze.com 2023-03-23 23:26 出处:网络
I know that this sends stuff to a php file and gets stuff returned from the php file as javascript: $.ajax(开发者_高级运维{

I know that this sends stuff to a php file and gets stuff returned from the php file as javascript:

 $.ajax(开发者_高级运维{
   type: "POST",
   url: "phpfile",
   cache: false,
   data: datahere,
   dataType: "script"
 });

But... suppose "datahere" is a file from a input file element. How am I supposed to get the value or data from that upload input file element?


Take a look at these plugins: 7 trusted ajax file upload plugins using jquery

Those are some AJAX file upload plugins. They might be what you need.


 $.ajax({
   type: "POST",
   url: "phpfile",
   cache: false,
   data: $('.thisInput').val(),
   dataType: "script"
 });
0

精彩评论

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