나는 많은 정보를 수집 한 양식을 가지고 있으며 여러 파일을 업로드해야합니다.여러 파일을 서버로 업로드
이 포럼의 Devi 덕분에이 양식의 다른 모든 측면이 완벽하게 작동하고 있습니다. 이제는 하나의 문제에만 집중하고 새로운 스레드를 시작하기로 결정했습니다. 이전/이전 스레드를 볼 수 있습니다. Insert into one Table, while updating another & File Upload
내 문제는 실제로 파일을 업로드하는 것입니다. 내 양식은 두 부분으로 진행됩니다. Part 1은 기본 HTML 레이아웃으로, 데이터베이스 테이블에 대한 정보 쓰기를 처리하는 PHP 파일을 가리키는 메소드가 있습니다.
<div class="form-group">
<label>Permit Renewal :</label>
<div class="input-group">
<label>
<input type="radio" class="minimal" value="0" <?php echo ($permit_renewal=='No')?'checked':'' ?> name="permit_renewal">
No
</label>
<label>
<input type="radio" class="minimal" value="1" <?php echo ($permit_renewal=='Yes')?'checked':'' ?> name="permit_renewal">
Yes
</label>
</div>
</div>
<div class="box-body">
<div class="form-group">
<div class="form-group">
<label for="scanned_permit_renewal">Attach File</label>
<input type="file" id="scanned_permit_renewal" name="scanned_permit_renewal">
<p class="help-block">Select a file to link to this outlet, the file name must be prefixed with the Outlet. E.g. 102987 - License 2016</p>
</div>
</div><!-- /.form-group -->
그리고 :
형태는 각각의 파일 업로드 (. 다른 파일 참조 4 개 업로드, 각이있다 즉 라이센스 문서, 갱신 문서, 신원 문서, 기타 문서)에 대한 다음과 같은 코드가 있습니다 관련 처리 부분은 내가 아니라 내 부패 디렉토리를 확인하고/업로드/폴더 존재가 있다는 것을 보장 한
if (isset($_FILES["file"]["name"])) {
foreach($_FILES['file']['tmp_name'] as $key => $tmp_name){
$file_name = $key.$_FILES['file']['name'][$key];
$file_size =$_FILES['file']['size'][$key];
$file_tmp =$_FILES['file']['tmp_name'][$key];
$file_type=$_FILES['file']['type'][$key];
$new_file = $_SERVER['DOCUMENT_ROOT'] . "/uploads/" . date("Ymd_his") . "_" . $file_name;
//echo $new_file;
move_uploaded_file($file_tmp,$new_file);
}
}
if($res1){
echo "Records added/updated successfully.";
}
header("refresh:2;url=../outlet_capture.php");
// close connection
$link->close();
입니다. 당신이 바로 모든 일을 한
JFYI를,이 사이트가 아닙니다 포럼 및 코드를 수정하도록 요청하는 질문은 주제와 관련이 없습니다. –