zoukankan      html  css  js  c++  java
  • TP文件上传

    一、单文件上传

    <form action="__ACTION__" enctype="multipart/form-data" method="post" >
    	<input type="text" name="name" />
    	<input type="file" name="photo" />
    	<input type="submit" value="提交" >
    </form>
    

     

    <?php
    namespace HomeController;
    use ThinkController;
    class LoginController extends Controller{
    	public function login(){
    		if(!empty($_POST)){
    			
    			$upd = new ThinkUpload();
    			$upd->rootPath = "./Public/";
    			$upd->savePath = "./upload/";
    			$info = $upd->upload();
    			
    			
    		}else{
    			$this->show();
    		}
    	}
    	
    }
    

    提交以后文件里多了一个文件夹

     

    二、多文件上传

    <form action="__ACTION__" enctype="multipart/form-data" method="post" >
    	<input type="text" name="name" />
    	<input type="file" name="photo" />
    	<input type="file" name="photo1" />
    	<input type="submit" value="提交" >
    </form>
    

     

    <?php
    namespace HomeController;
    use ThinkController;
    class LoginController extends Controller{
    	public function login(){
    		if(!empty($_POST)){
    			
    			$upd = new ThinkUpload();
    			$upd->rootPath = "./Public/";
    			$upd->savePath = "./upload/";
    			$info = $upd->upload();
    			var_dump($info);
    			
    			
    		}else{
    			$this->show();
    		}
    	}
    	
    }
    

     上传两张图片

  • 相关阅读:
    python+webdriver(二)
    python+webdriver(一)
    重逢
    在C,C++,java和python运行时解释器和编译器的区别
    hive调优
    github 操作指南
    jupyter 启动时的问题
    海量数据模型实施方法论
    python之Tkinker学习
    使用cmd命令行进行本地证书读取
  • 原文地址:https://www.cnblogs.com/navyouth/p/8596034.html
Copyright © 2011-2022 走看看