0
이 자바 스크립트 코드 광고는 4 장의 사진을 업로드하도록 수정되었습니다.이 작품은 4 장의 사진을 다운로드하기 때문에 잘되지만 동일한 경로를 가져옵니다. 모든 그림 마녀는 네 번 같은 그림입니다. 참고 랜덤 넘버 생성기를 사용하여 그림이 고유한지 확인합니다.업로드 여러 파일 업로드 4 시간 동일 파일
i=0;
$(function(){
var btnUpload=$('#upload');
var status=$('#status');
new AjaxUpload(btnUpload, {
action: 'upload-file.php',
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
status.text('Only JPG, PNG or GIF files are allowed');
return false;
}
else if(i>=4){addClass('error');}
status.text('Uploading...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
//Add uploaded file to list
if(response==="success"&&i<=3){
$('<li></li>').appendTo('#files').html('<img src="./uploads/'+file+'" alt="" /><br />'+file).addClass('success');
i++;} else{
$('<li></li>').appendTo('#files').text(file).addClass('error');
}
}
});
});
모든 다운로드의 치료를위한 블록은 다음과 같습니다 당신이 제공 한 정보로
<?php
session_start();
if($_SESSION['upload-file'] == "AAA"){$_SESSION['upload-file']=0;}
$uploaddir = 'uploads/';
$random_digit = rand(0,1000000);
$file = $uploaddir.$random_digit.basename($_FILES['uploadfile']['name']);
if($_SESSION['upload-file'] == 0){$_SESSION['Photo1'] = $file;$_SESSION['upload- file']++;}
if($_SESSION['upload-file'] == 1){$_SESSION['Photo2'] = $file;$_SESSION['upload-file']++;}
if($_SESSION['upload-file'] == 2){$_SESSION['Photo3'] = $file;$_SESSION['upload-file']++;}
if($_SESSION['upload-file'] == 3){$_SESSION['Photo4'] = $file;$_SESSION['upload-file']++;$_SESSION['upload-file']="AAA";}
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
echo "success";
} else {
echo "error";
}
the variable $_SESSION['upload-file'] ='AAA'; is only to create a loop.
So the block up there goes into file end_temp_p.php and the second block is upload-file.php
This donwload 4 time the same file wich look like a paradox