首页 > 解决方案 > 如何设置要上传的 2mb 图像的最大时间

问题描述

文件名 = $_FILES['uploaded']['name']; $this->tmpName = $_FILES['uploaded']['tmp_name']; if( !$this->isWritable() ) { die( "抱歉,您必须将上传目标 CHMOD 到 777!" ); } if( !$this->checkExt() ) { die( "对不起,你不能上传这个文件类型!" ); } if( !$this->checkSize() ) { die( "对不起,你上传的文件太大了!" ); } if( $this->fileExists() ) { die( "对不起,这个文件已经存在于我们的服务器上!" ); } if( $this->uploadIt() ) { echo "成功"; echo "您的文件已上传!

点击上传目标。时间() 。$this->文件名。"\">在这里查看您的文件!"; } else { echo "抱歉,由于某种未知原因,您的文件无法上传!"; } } public function uploadIt() { return ( move_uploaded_file( $this->tmpName, $this->uploadTarget .time() . $this->fileName ) ? true : false ); } public function checkSize() { return ( ( filesize( $this->tmpName ) > $this->maxSize ) ? false: true ); } public function getExt() { return strtolower( substr( $this->fileName, strpos( $this->fileName, "." ), strlen( $this->fileName ) - 1 ) ); } public function checkExt() { return ( in_array( $this->getExt(), $this-> 分机)?真假 ); } 公共函数 isWritable() { return ( is_writable( $this->uploadTarget ) ); } 公共函数 fileExists() { return ( file_exists( $this->uploadTarget . time() . $this->fileName ) ); } } $img = 新的 imgUploader(); ?>

标签: javascriptjqueryhtml

解决方案


推荐阅读