그누보드 쇼핑몰 상품등록 파일 업로드 추가 관련
본문
안녕하세요.
apmsetup 으로 사이트를 만들고 있습니다.
쇼핑몰 상품 등록 페이지에서 목록중에 여분필드를(it_1, it_2....... it_10) 첨부파일 업로드로 변경해서 쓰고 있는데
생각보다 올릴 자료가 많고 분야별로 추가 등록이 많아져서
'상품추가옵션' 을 이용하여 'itemoption.php' 추가로 첨부파일을 등록 하려고 합니다.
여기에 파일업로드를 적용하려고 하는데 첨부자료는 등록이 안되더군요.... 왜 그런지 도와주세요.
itemnozzle.php
<?php
if($it['it_id']) {
for($tech_data=1; $tech_data<=28; $tech_data++) {
for($i=0; $row=sql_fetch_array($result); $i++) {
$nozzle_id = $row['io_id'];
$nozzle_val = explode(chr(30), $nozzle_id);
$nozzle_subject = $nozzle_val[0];
$nozzle_use = $row['io_use'];
$nozzle_ = $row['iot_'.$tech_data];
$nozzle_unit = $row['iot_'.$tech_data.'_unit'];
$nozzle_img = $row['iot_'.$tech_data.'_img'];
?>
//--- 생략 ---
<?php for($tech_data=1; $tech_data<=28; $tech_data++) { ?>
<tr>
<td class="td_nozzle_3" colspan="2">
<label for="nozzle_<?php echo $tech_data; ?>_img_<?php echo $i; ?>">다운로드 <?php echo $tech_data ?> 파일</label>
<input type="file" name="it_<?php echo $tech_data; ?>_img" value="<?php echo get_text($row['iot_'.$tech_data.'_img']) ?>" id="it_<?php echo $tech_data; ?>_img" style="width:300px">
<?php echo get_text($it['iot_'.$tech_data.'_img']) ?>
</td>
</tr>
itemformupdate.php
// 노즐 정보 -----------------------------------------
if($w == "u") {
$sql = " select iot_1_img
from {$g5['g5_shop_item_nozzle_table']}
where it_id = '$it_id' ";
$file = sql_fetch($sql);
$it_1_img = $file['iot_1_img'];
}
$it_nozzle_dir = G5_DATA_PATH.'/nozzle';
// 노즐삭제
if ($it_nozzle1_del) {
$file_nozzle1 = $it_nozzle_dir.'/'.$it_1_img;
@unlink($file_nozzle1);
delete_nozzle_thumbnail(dirname($file_nozzle1), basename($file_nozzle1));
$it_1_img = '';
}
// 노즐업로드
if ($_FILES['iot_1_img']['name']) {
if($w == 'u' && $it_1_img) {
$file_nozzle1 = $it_nozzle_dir.'/'.$it_1_img;
@unlink($file_nozzle1);
delete_nozzle_thumbnail(dirname($file_nozzle1), basename($file_nozzle1));
}
$it_1_img = it_nozzle_upload($_FILES['iot_1_img']['tmp_name'], $_FILES['iot_1_img']['name'], $it_download_dir.'/'.$it_id);
}
// 노즐 끝 -------------------------------------------
shop.lip.php
// 노즐 업로드
function it_nozzle_upload($srcfile, $filename, $dir)
{
if($filename == '')
return '';
if(!is_dir($dir)) {
@mkdir($dir, G5_DIR_PERMISSION);
@chmod($dir, G5_DIR_PERMISSION);
}
$filename = preg_replace("/\s+/", "", $filename);
$filename = preg_replace("/[#\&\+\-%@=\/\\:;,'\"\^`~\|\!\?\*\$#<>\(\)\[\]\{\}]/", "", $filename);
$filename = preg_replace_callback(
"/[가-힣]+/",
create_function('$matches', 'return base64_encode($matches[0]);'),
$filename);
upload_file($srcfile, $filename, $dir);
$file = str_replace(G5_DATA_PATH.'/nozzle/', '', $dir.'/'.$filename);
return $file;
}
// 노즐 썸네일 삭제
function delete_nozzle_thumbnail($dir, $file)
{
if(!$dir || !$file)
return;
$filename = preg_replace("/\.[^\.]+$/i", "", $file); // 확장자제거
$files = glob($dir.'/thumb-'.$filename.'*');
if(is_array($files)) {
foreach($files as $thumb_file) {
@unlink($thumb_file);
}
}
}
dbconfig.php
$g5['g5_shop_item_nozzle_table'] = G5_SHOP_TABLE_PREFIX.'item_nozzle'; // 상품노즐 테이블
를 추가하여 적용 시켰습니다.
답변좀 부탁 드릴께요..
답변을 작성하시기 전에 로그인 해주세요.