Home> PHP Framework> ThinkPHP> body text

How does Thinkphp combine with ajaxFileUpload to implement asynchronous image transmission with ajax?

PHPz
Release: 2023-05-30 22:13:04
forward
1006 people have browsed it

1. Reference files

First introduce the jQuery and ajaxFileUpload plug-ins. Pay attention to the order. Needless to say, this is true for all plug-ins.

 
Copy after login

2. HTML code

Copy after login

3. JS code

Copy after login

4. Background processing (PHP)

//单文件(包含单文件)异步上传 public function upload_image(){ //图片上传 $file = request()->file(input('name')); $info = $file->move(ROOT_PATH . 'public/uploads/images'); if($info) { return json_encode($info->getSaveName()); } }
Copy after login

5. Foreground call

    {volist name="data" id="vo"}
  • {$vo.title}

    {$vo.title}

  • {/volist}
Copy after login

The above is the detailed content of How does Thinkphp combine with ajaxFileUpload to implement asynchronous image transmission with ajax?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!