파일 다운로드 후 창닫기(재질문)ㅠㅠ

파일 다운로드 후 창닫기(재질문)ㅠㅠ

QA

파일 다운로드 후 창닫기(재질문)ㅠㅠ

본문

파일 다운로드 후 창닫기 하려고 합니다ㅠㅠ 코드첨부해서 다시 한번 올리겠습니다..

 

1. 여기로 시작해서 저기 a태그를 누르면



<div class="sec-white" align="center">
    <div class="sec-content" align="center">
        <div class="features-list block-1-3 block-m-1-2 block-mob-full group">
            <div class="bgrid feature" data-aos="fade-up"> <img src="<?= G5_THEME_IMG_URL ?>/images/res-facilities.png"/><br>
                <a href="<?=G5_URL?>/form-download.php?file_no=1" class="button button-demo cta win_resources" target="_blank">파일1번</a>
            </div>
            <div class="bgrid feature" data-aos="fade-up"> <img src="<?= G5_THEME_IMG_URL ?>/images/res-manufact.png"/><br>
                <a href="<?=G5_URL?>/form-download.php?file_no=2" class="button button-demo cta win_resources" target="_blank">파일2번</a>
            </div>
            <div class="bgrid feature" data-aos="fade-up"> <img src="<?= G5_THEME_IMG_URL ?>/images/res-hospital.png"/><br>
                <a href="<?=G5_URL?>/form-download.php?file_no=0" class="button button-demo cta win_resources" target="_blank">파일3번</a>
            </div>
        </div>
    </div>
</div>

 

아래와 같은 이름과 이메일 수집하는 form창이 뜹니다.



<form name="fpasswordlost" id="fpasswordlost" action="<?php echo G5_BBS_URL ?>/form-download_update.php" onsubmit="return fpasswordlost_submit(this);" method="post" autocomplete="off">


<tr>
    <td>성명<span id="red3"></span></td>
    <td><input class="full-width" type="text" id="sampleInput3"  name="name" maxlength="50"></td>
</tr>


<tr>
    <td>이메일<span id="red5">*</span></td>
    <td><input class="full-width" type="email" id="sampleInput5" name="email" required maxlength="50"></td>
</tr>


<div align="center"><input class="button" type="submit" value="다운로드"></div>


</form>


그러고 해당 액션으로 오면



<?php
include_once('./_common.php');


extract($_POST);


if ($file_no == "")
    alert_close('올바른 방법으로 이용해 주십시오.'); // 파일 있는지 확인


$sql = "insert into download_list set file_no = '{$file_no}', name = '{$name}', email = '{$email}', date = NOW() "; 


sql_query($sql, false );// db에 insert


header('Content-Type: application/x-octetstream');
header('Content-Length: '.filesize($filepath));
header('Content-Disposition: attachment; filename='.$file[$file_no]['file']);
header('Content-Transfer-Encoding: binary');

$fp = fopen($filepath, "r");
fpassthru($fp);

fclose($fp);

 

여기까지하면 파일 다운로드는 잘 됩니다.. 근데 그 이후 창을 닫는 작업이 안되서 질문올립니다

이것저것 넣어보고 알게 된건.. fclose($fp); 이 이후에 코드는 아예 안먹히고있어영..

도와주세요ㅠㅠ

이 질문에 댓글 쓰기 :

답변 1

fclose 했다는건 파일을 보내줬다는 말이기때문에 거기서는 어떻게 할수 있는게 없습니다.

 

하려고 한다면

fpasswordlost 의 action을 함수로 만들어서

self.close 하고 window.location 해서 해당 php 로 넘어가게 하면 안될까요?

답변을 작성하시기 전에 로그인 해주세요.
전체 43
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT