iframe 기술을 사용하여 양식에 포함 된 파일을 업로드하고 있습니다.업로드 'AJAX'업로드 트릭 후에 iframe이 업데이트되지 않습니다.
완벽하게 작동합니다. 파일을 이메일로 보내도됩니다. 유일한 문제는 파일 크기와 같은 iframe에서 정보를 얻고 싶다는 것입니다. 그러나, 나는 PHP 스크립트에서 iframe의 내용을 업데이트 할 수 없습니다. 전자 메일을 보내기 전에 줄에 '에코 (echos)'를 넣으려고 했으므로 실제로 도착합니다.하지만 iframe의 jQuery의 "로드"함수가 실행되자 마자 iframe에 아무 것도 없습니다. "요소 검사"및 "소스보기"도 모두 시도해 보았습니다. 모두 비어 있습니다.
나는 분명한 뭔가를 놓치고 있습니까? 나는 SO 또는 google에 동일한 문제가있는 사람을 찾을 수 없습니다.
FORM :
는<form id="submitResumeForm" method="post" enctype="multipart/form-data" action="career/sendResume" target="submitTarget">
<!-- input fields, etc -->
<input type="button" onClick="submitForm()" value="<?=lang('submit')?>" />
</form>
<iframe id="submitTarget" name="submitTarget" src="" style="position:absolute;top:-1000px;left:-1000px;width:0;height:0;border:0px solid #fff;"></iframe>
JAVASCRIPT :
는function submitForm()
{
$('#submitResumeForm').attr('target', 'submitTarget');
// ... verifications ...
$('#submitTarget').load(function()
{
console.log($(this).html()); // Content is: "content before"
console.log($(this).contents()); //Garbage
});
// Line Below puts content in the iframe, and that content is still there after
// the php is executed, so iframe is NEVER updated
$('#submitTarget').html('content before');
$("#submitResumeForm").submit();
}
PHP 컨트롤러 : 난 당신이 잘못하고 있다고 생각
function sendResume()
{
echo 'ASDFASDFASDFASDF';
$this->load->library('email');
$this->email->clear();
$this->email->to($this->input->post('email'));
// ... other fields, attach file (working perfectly)
$this->email->send();
}
우리 모두의 코드를 보여주세요. – Joe
iframe의 내용을로드하라는 요청이 서버의 내용에 의해 차단되어 HTML을 반환하지 않습니다. 물건이 잘못 될 수있는 몇 가지 장소가 있습니다. 이 질문에 답하기 위해서는 더 많은 정보가 필요합니다. 하지만 제발,이 질문/답변을 읽고, 도움이됩니다 : http://stackoverflow.com/questions/8034987/ajax-file-upload-with-iframe-returning-and-using-the-filename-for-additional-a –
stackoverflow에서 링크를 확인했지만 답변을 시도하지 않았습니다. 모든 코드에서 더 낫겠지 만 codeigniter 프레임 워크를 사용하므로 테스트 할 전체 응용 프로그램이 필요합니다. 어쨌든, 내가 할 수있는 것을 게시 할 것입니다. CI를 아는 사람이라면 무엇을 할 수 있는지 자유롭게 알 수 있습니다. – NaturalBornCamper