2013-11-26 96 views

回答

1

這是我用nicupload.php做的事情。 找到這條線。定義你的路徑。

define('NICUPLOAD_PATH', '../uploads'); 


if($_SERVER['REQUEST_METHOD']=='POST') { // Upload is complete 

    $file = $_FILES['image']; 
    $image = $file['tmp_name']; 
    $id = $file['name']; 

    $max_upload_size = ini_max_upload_size(); 
    if(!$file) { 
     nicupload_error('Must be less than '.bytes_to_readable($max_upload_size)); 
    } 

    $ext = strtolower(substr(strrchr($file['name'], '.'), 1)); 
    @$size = getimagesize($image); 
    if(!$size || !in_array($ext, $nicupload_allowed_extensions)) { 
     nicupload_error('Invalid image file, must be a valid image less than '.bytes_to_readable($max_upload_size)); 
    } 

    $filename = $id; 
    $path = NICUPLOAD_PATH.'/'.$filename; /*****Path must be set here*******/ 

    if(!move_uploaded_file($image, $path)) { 
     nicupload_error('Server error, failed to move file'); 
    } 

    $status = array(); 
    $status['done'] = 1; 
    $status['width'] = $size[0]; 
    $rp = realpath($path); 
    $status['url'] = NICUPLOAD_URI ."/".$id; 


    nicupload_output($status, false); 
    exit; 
} 
+0

非常感謝。我已經解決了這個問題。你的回答是正確的。 –

+0

嗨我也收到錯誤。但這不起作用。修復後請粘貼'nicUpload.php'的完整頁面代碼。謝謝 –