2013-04-02 35 views
0

我正在嘗試使用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

必須有一定的誤差。你能告訴我們'var_dump($ _ FILES ['image'] ['error']);'? – Rikesh

+0

如果您獲得答案,請選擇最有幫助的答案。 否則你可以發佈你自己的答案。 – MageDev

回答

0

變化upload_max_filesize在php.ini

0

C:\ WAMP \在此搜索php.ini文件,並在此文件斌\ PHP \ php5.2.6

你需要設置upload_max_filesize ...

0

有時我們上傳的文件少於2 MB。它正常上傳,因爲默認upload_max_filesize在php.ini中有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在上傳文件