20110720

Format My Source Code for Blogging

轉程式碼

session失效

js中使用window.location.href來指定頁面的跳轉,會被認為是一個新的html請求,因此會清空session

window.location與document.URL的不同是一個取得物件一個取得唯獨的字串
解決辦法
From what I remember, the only way to do it would be by doing something like

window.location.href='page.php?<?php echo session_name().'='.session_id();?>' 

20110703

$_FILES Error Messages Explained

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.