0
我與JS的文件,該文件是與SRC圖像發送所有的數據形式,除了輸入文件的數據的問題如何輸入文件的數據傳遞到另一個file.php使用javascript
$(document).ready(function(){
//PURE PATH TO IMAGE GENERATING PHP FILE
var base = $(".preview img").attr("src");
//GATHER IMAGE FOR FIRST TIME
$(".preview img").attr("src",base+'?'+$(".form-horizontal").serialize());
//KEYUP EVENT AND NEW IMAGE GATHER
$(".form-horizontal input,textarea").stop().keyup(function(){
$(".preview img").attr("src",base+'?'+$(".form-horizontal").serialize());
});
$("#getResults").click(function(){
$("#resultsUrl").val($(".preview img").attr("src"));
$("#link").show("slow");
});
});
<form method="post" action="member_save.php">
<input type="text" name="firstname" required>
<input type="text" name="lastname" required>
<input type="file" name="image" accept="image/*" required>
<button name="submit" type="submit">save</button>
</form>
<div id="preview" class="preview">
<img src="mpdf-master/recto.php" style=" margin-right:-72%; width:70%; />'].""
</div>
使用AJAX來JS和PHP – Dino
的可能的複製之間的通信(https://stackoverflow.com [使用Ajax的一種形式上傳數據和文件?] /問題/ 10899384 /上載,既數據和 - 文件功能於一身的外形使用,AJAX) – jkp