Blueimp jQuery File Upload plugin - “Empty file upload” result PHP

后端 未结 6 858
暖寄归人
暖寄归人 2021-01-04 22:59

Here\'s the plugin: https://github.com/blueimp/jQuery-File-Upload

I\'m having a problem getting the response I want from the plugin after uploading a file.

O

6条回答
  •  囚心锁ツ
    2021-01-04 23:38

    OK, this seems like it is not a jQuery problem, but rather a server-side issue. In my case it is a PHP script, which needed tweaking as follows.

    See function post(), edit this line

    $json = json_encode($info);
    

    to

    $json = json_encode(array($this->options['param_name'] =>$info));
    

    and I had to also edit the echo at the last line of the function; instead of

    echo $json;
    

    there is now

    echo str_replace('\/','/',$json);
    

    It seems to work fine returning a correct json array. Hope it helps.

提交回复
热议问题