tp上传到七牛 文件大了就无法上传 但是没有限制
config.php没有限制 如下
'UPLOAD_SITEIMG_QINIU' => array (
'rootPath' => './',
'saveName' => array ('uniqid', ''),
'driver' => 'Qiniu',
'driverConfig' => array (
'secrectKey' => '1111',
'accessKey' => '222',
'domain' => '333',
'bucket' => '444',
)),
上传的时候
//上传到七牛
$setting=C('UPLOAD_SITEIMG_QINIU');
$Upload = new \Think\Upload($setting);
$info = $Upload->upload($_FILES);
dump($_FILES['pic']['name']);
dump($setting);
dump($Upload);
exit;
得到
string(6) "32.gif"
array(4) {
["rootPath"] => string(2) "./"
["saveName"] => array(2) {
[0] => string(6) "uniqid"
[1] => string(0) ""
}
["driver"] => string(5) "Qiniu"
["driverConfig"] => array(4) {
["secrectKey"] => string(40) "111"
["accessKey"] => string(40) "222"
["domain"] => string(25) "p0xjmu7mz.bkt.clouddn.com"
["bucket"] => string(7) "333"
}
}
object(Think\Upload)#10 (3) {
["config":"Think\Upload":private] => array(14) {
["mimes"] => array(0) {
}
["maxSize"] => int(0)
["exts"] => array(0) {
}
["autoSub"] => bool(true)
["subName"] => array(2) {
[0] => string(4) "date"
[1] => string(5) "Y-m-d"
}
["rootPath"] => string(2) "./"
["savePath"] => string(0) ""
["saveName"] => array(2) {
[0] => string(6) "uniqid"
[1] => string(0) ""
}
["saveExt"] => string(0) ""
["replace"] => bool(false)
["hash"] => bool(true)
["callback"] => bool(false)
["driver"] => string(5) "Qiniu"
["driverConfig"] => array(4) {
["secrectKey"] => string(40) "111"
["accessKey"] => string(40) "222"
["domain"] => string(25) "p0xjmu7mz.bkt.clouddn.com"
["bucket"] => string(7) "333"
}
}
["error":"Think\Upload":private] => string(24) "没有文件被上传!"
["uploader":"Think\Upload":private] => object(Think\Upload\Driver\Qiniu)#11 (4) {
["rootPath":"Think\Upload\Driver\Qiniu":private] => string(1) "/"
["error":"Think\Upload\Driver\Qiniu":private] => string(0) ""
["config":"Think\Upload\Driver\Qiniu":private] => array(5) {
["secrectKey"] => string(40) "111"
["accessKey"] => string(40) "222"
["domain"] => string(25) "p0xjmu7mz.bkt.clouddn.com"
["bucket"] => string(7) "333"
["timeout"] => int(300)
}
["qiniu"] => object(Think\Upload\Driver\Qiniu\QiniuStorage)#12 (8) {
["QINIU_RSF_HOST"] => string(18) "http://rsf.qbox.me"
["QINIU_RS_HOST"] => string(17) "http://rs.qbox.me"
["QINIU_UP_HOST"] => string(22) "http://up-z2.qiniu.com"
["timeout"] => int(3600)
["sk"] => string(40) "111"
["ak"] => string(40) "222"
["domain"] => string(25) "333"
["bucket"] => string(7) "444"
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可以查看下是否是php.ini对上传文件的大小做了限制,分别查看upload_max_filesize和post_max_size的配置
对于七牛,并不建议使用php后端进行中转上传。
而是采用 php 负责授权,客户端负责上传的方式来处理。以减轻自身服务器的压力。