dropzonejs의 데모 업로드 페이지 수정: (원본 주소: http://www.dropzonejs.com/exa...) 파일 업로드 처리가 완료된 후 처리 결과가 나타나는지 확인하고 싶습니다. 내부적으로는 어떻게 해야 합니까?
index.php 파일 내용은 다음과 같습니다.
<code><!DOCTYPE html> <meta charset="utf-8"> <title>Dropzone simple example</title> <!-- DO NOT SIMPLY COPY THOSE LINES. Download the JS and CSS files from the latest release (https://github.com/enyo/dropzone/releases/latest), and host them yourself! --> <script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"></script> <link rel="stylesheet" href="https://rawgit.com/enyo/dropzone/master/dist/dropzone.css"> <p> This is the most minimal example of Dropzone. The upload in this example doesn't work, because there is no actual server to handle the file upload. </p> <!-- Change /upload-target to your upload address --> <form action="upload_file.php" class="dropzone"></form> <div > <textarea class="result" rows="16" cols="265" id="res"></textarea> </div></code>
upload_file.php 파일 내용은 다음과 같습니다.
<code><?php echo "---start---\n"; if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; $content = file_get_contents($_FILES["file"]["tmp_name"]); echo $content; } ?></code>
dropzonejs의 데모 업로드 페이지 수정: (원본 주소: http://www.dropzonejs.com/exa...) 파일 업로드 처리가 완료된 후 처리 결과가 나타나는지 확인하고 싶습니다. 내부적으로는 어떻게 해야 합니까?
index.php 파일 내용은 다음과 같습니다.
<code><!DOCTYPE html> <meta charset="utf-8"> <title>Dropzone simple example</title> <!-- DO NOT SIMPLY COPY THOSE LINES. Download the JS and CSS files from the latest release (https://github.com/enyo/dropzone/releases/latest), and host them yourself! --> <script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js"></script> <link rel="stylesheet" href="https://rawgit.com/enyo/dropzone/master/dist/dropzone.css"> <p> This is the most minimal example of Dropzone. The upload in this example doesn't work, because there is no actual server to handle the file upload. </p> <!-- Change /upload-target to your upload address --> <form action="upload_file.php" class="dropzone"></form> <div > <textarea class="result" rows="16" cols="265" id="res"></textarea> </div></code>
upload_file.php 파일 내용은 다음과 같습니다.
<code><?php echo "---start---\n"; if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; $content = file_get_contents($_FILES["file"]["tmp_name"]); echo $content; } ?></code>
업로드된 이미지 주소를 ajax를 통해 얻어서 표시할 수 있습니다