g5_shop_item_option_table 중 spl 에 이미지 파일을 업로드 하고 싶어요.

g5_shop_item_option_table 중 spl 에 이미지 파일을 업로드 하고 싶어요.

QA

g5_shop_item_option_table 중 spl 에 이미지 파일을 업로드 하고 싶어요.

답변 1

본문

상품 등록 페이지에서 

 

상품추가옵션 중 '단위'($spl)에 글대신 이미지파일을 업로드를 하려고 합니다.

 

spl 이름은 iot_1_img 으로 변경 했습니다.

 

방법좀 알려주세요. 

 

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);
 
    $nozzle_1_img    = $file['iot_1_img'];
}
 
$it_nozzle_dir = G5_DATA_PATH.'/item';
 
// 파일삭제
if ($nozzle_1_img_del) {
    $file_nozzle1 = $it_nozzle_dir.'/'.$nozzle_1_img;
    @unlink($file_nozzle1);
    delete_nozzle_thumbnail(dirname($file_nozzle1), basename($file_nozzle1));
    $nozzle_1_img = '';
}
 
// 파일업로드
if ($_FILES['iot_1_img']['name']) {
    if($w == 'u' && $nozzle_1_img) {
        $file_nozzle1 = $it_nozzle_dir.'/'.$nozzle_1_img;
        @unlink($file_nozzle1);
        delete_nozzle_thumbnail(dirname($file_nozzle1), basename($file_nozzle1));
    }
    $nozzle_1_img = it_nozzle_upload($_FILES['iot_1_img']['tmp_name'], $_FILES['iot_1_img']['name'], $it_nozzle_dir.'/'.$it_id);
} 

 

itemsupply.php


<?php for($tech_data=1; $tech_data<=28; $tech_data++) { ?> 
<tr>
<td>
<label for="iot_<?php echo $tech_data; ?>_img" class="sound_only"></label>이미지<?php echo $tech_data; ?>
<input type="file" name="iot_<?php echo $tech_data; ?>_img" value="<?php echo get_text($row['iot_'.$tech_data.'_img']) ?>" id="iot_<?php echo $tech_data; ?>_img" class="frm_input" size="5"></td>
</tr>
<?php } ?>

이 질문에 댓글 쓰기 :

답변 1

왜 db에 이미지 파일을 업로드하려고 하시죠?

db 용량 커지면 비용면에서 안좋은데

 

그냥... 파일네임또는 경로가 포함된 파일명을 db에 올리는게 일반적인데요

 

db 용량 커지면 골치아파지실텐데요

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 1,534
© SIRSOFT
현재 페이지 제일 처음으로