【dropzone.js】特定の文字を含む画像だけ出力しない

f:id:tsumayouzi:20140806101901j:plain

 アップロードしたくない場合

【image.upload.php(アップロード側)】

//ドロップされたアイテム毎にこのスクリプトにリクエストがきて、一つ一つが像を処理する。
$path = "/usr/local/httpd/....images/";
if (!empty($_FILES)){
$tempname = $_FILES['file']['name'];
$tempFile = $_FILES['file']['tmp_name'];
$targetFile = $path. $_FILES['file']['name'];
if (!strstr($file, '_a.gif')) {
move_uploaded_file($tempFile,$targetFile);
}
echo $tempFile;

 

アップロードはしつつ、フォームなどを出したくない場合↓ 

ajax_get_uploades_files.php

include("./inc/JsonResponse.Class.inc");
$json = new JsonResponse();
//最初に先にアップデートされてる一時ファイルを全部削除する
$path = "/usr/local/httpd/admin/social/cc/cc_item_add/upload/";
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if(!preg_match("/.gif$|.txt$|.png$/",$file)) continue;
//ここに省きたい画像の識別文字を追加
if (!strstr($file, '_a.gif')) {
$uploaded_file[] = $file;
}
}
closedir($handle);
}

$json->setArray($uploaded_file);
$json->sendResponse();
exit;