问题描述
我正在尝试通过vBulletin中的adminCP上传文件,我已经在页面中创建了输入字段
print_upload_row('Product Screenshot','preview');
转换为adminCP(源视图)中的设置:
<input type="file" class="bginput" name="preview" size="35" tabindex="1">
提交输入后,我就定义它,因为我使用的每个参考文件都包含它:
$file = $vbulletin->input->clean_gpc('f','preview',TYPE_FILE);
然后给它一些方向
if ($file['error'] !== 4)
{
$dir = DIR . '/images/productthumbs/';
if (!is_dir($dir))
{
die(construct_phrase($vbphrase['invalid_directory'],$dir));
}
$ext = substr($file['name'],strrpos($file['name'],'.'));
$new_file = $dir . basename('thumbnail_product_' . $id . $ext);
print_dots_start('Uploading Image');
if (!move_uploaded_file($file['tmp_name'],$new_file))
{
print_dots_stop();
die(construct_phrase('Error Uploading File',$file['error']));
}
print_dots_stop();
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX .
"cartplog_products SET thumbnail_ext = '" . $ext . "' WHERE productid = '" . $id . "'");
}
我一直在脚本Error Uploading File
中收到错误,但是我的错误日志中没有任何内容可以帮助调试。
我知道目录在那里,sql表是正确的,我尝试过删除变量和硬编码数字IE:
$new_file = $dir . basename('thumbnail_product_12' . $ext);
"cartplog_products SET thumbnail_ext = '" . $ext . "' WHERE productid = '12'");
我已经删除了IF条件,以查看是否会出现错误,除了文件将不会上传以外,什么都没有发生。但是,我的代码与我所基于的另一种产品几乎完全相同,区别在于与sql一起使用的表,并且该代码没有任何组合。
我是否缺少处理此上传所需的任何信息?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)