修改了下dropzonejs的demo上传页面:(原地址:http://www.dropzonejs.com/exa...)加了个textarea,想实现文件上传处理完成后将处理结果回显到textarea内,请问该如何处理?
以下是index.php文件内容:
立即学习“PHP免费学习笔记(深入)”;
<!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>
以下是upload_file.php文件内容:
<?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; } ?>
修改了下dropzonejs的demo上传页面:(原地址:http://www.dropzonejs.com/exa...)加了个textarea,想实现文件上传处理完成后将处理结果回显到textarea内,请问该如何处理?
以下是index.php文件内容:
立即学习“PHP免费学习笔记(深入)”;
<!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>
以下是upload_file.php文件内容:
<?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; } ?>
可以通过ajax获取上传后的图片地址,然后显示
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号