2011-03-28 15 views
0

내가 원하는 것은 그 이미지가 다른 어떤 것도 표시되지 않는다는 것입니다.이미지가 표시되지 않습니다.

다른 스크립트로 작업하고 있지만 동일한 문제가 있습니다.

I 이미지는 삭제되지만 표시되지 않습니다. 문제는 나에게 분명하지 않다

<?php 
// directory separator 
defined("DS") 
    || define("DS", DIRECTORY_SEPARATOR); 

// root path 
defined("ROOT_PATH") 
    || define("ROOT_PATH", realpath(dirname(__FILE__))); 

// upload folder directory 
defined("UPLOAD_DIR") 
    || define("UPLOAD_DIR", "../imagefolder"); 

// path to the upload folder 
defined("UPLOAD_PATH") 
    || define("UPLOAD_PATH", ROOT_PATH.DS.UPLOAD_DIR); 


function getAllFiles($folder = null) { 
    if(!empty($folder) && is_dir($folder)) { 
     if($handle = opendir($folder)) { 
      $out = array(); 
      while($file = readdir($handle)) { 
       if(is_file($folder.DS.$file)) { 
        $out[] = $file; 
       } 
      } 
      closedir($handle); 
      return $out; 
     } 
     return false; 
    } 
    return false; 
} 

$files = getAllFiles(UPLOAD_PATH); 

if (!empty($_POST['file'])) { 
    foreach($_POST['file'] as $file) { 
     unlink(UPLOAD_PATH.DS.$file) or die("Failed to <strong class='highlight'>delete</strong> file"); 
    } 
    header("location: " . $_SERVER['REQUEST_URI']); 
} 
?> 

<?php if (!empty($files)) { ?> 

    <form name="form1" method="post"> 
     <?php foreach($files as $key => $file) { ?> 
      <label for="file_<?php echo $key; ?>"> 
       <input type="checkbox" name="file[]" id="file_<?php echo $key; ?>" value="<?php echo $file; ?>" /> 
       <?php echo UPLOAD_DIR.DS.$file; ?> 
      </label> 
     <?php } ?> 
     <input type="submit" name="delete" value="Delete" /> 
    </form> 

<?php } ?> 
+0

문제는 무엇인가에

<?php echo UPLOAD_DIR.DS.$file; ?> 

변경 시도 할 수 있습니다? – powtac

+1

나는

답변

1

그러나 당신이 (각각 "삭제"체크 박스 옆) 형태로 이미지를 표시 할 표시하므로 사용자가 그들이 무엇인지 볼 수 있습니다

내 코드입니다 삭제 하시겠습니까?

그렇다면, 당신은

<img src=<?php echo UPLOAD_DIR.DS.$file; ?> /> 
관련 문제