我正在尝试使用html输入标记上传更大尺寸的图像,如4608X3500像素。 但无法获得文件大小。
我正在使用此代码获取文件详细信息:
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
$filename = basename($_FILES['image']['name']);
在此,我没有得到类型值和大小值显示为0.
答案 0 :(得分:1)
可能文件太大了。什么
var_dump($_FILES['image']['error'])
显示?如果它不为零,则发生错误。代码在此处定义:http://php.net/manual/en/features.file-upload.errors.php
答案 1 :(得分:0)
更改php.ini中的upload_max_filesize
答案 2 :(得分:0)
C:\瓦帕\ BIN \ PHP中\ php5.2.6
在这个搜索php.ini文件中,你需要设置upload_max_filesize ...
答案 3 :(得分:0)
有时我们上传的文件少于2 MB。它正常上传,因为在php.ini默认情况下upload_max_filesize
有2M,这意味着2 MB。在另一个手文件大小超过2 MB需要在php.ini upload_max_filesize
中进行更改。您也可以使用
var_dump($_FILES['image']['error'])
此处列出了相关值
UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
UPLOAD_ERR_EXTENSION
Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.'
参考此处: - http://php.net/manual/en/features.file-upload.errors.php