0
我想在窗體上添加一個非常簡單的拖放輸入。表單處理由我使用的平臺完成,所以這不是問題。上傳本身工作相對良好,圖像預覽顯示,但是當我提交表單時,圖像不在POST中。另外,我需要使用特定參數發佈該映像。任何人都可以點亮一下嗎?下面是我有:dropzone.js和字段參數
<form name="cart_quantity" action="MY_URL_HERE" method="post" enctype="multipart/form-data">
<input type="text" name="quantity" value="1" maxlength="6" size="4" />
<input type="submit" value="Add to Cart" /> <br />
<input type="radio" name="id[3]" value="7" id="attrib-3-7" /><label for="attrib-3-7">16 Inch Square</label><br />
<input type="radio" name="id[3]" value="8" id="attrib-3-8" /><label for="attrib-3-8">20 Inch Square (+$5.00)</label><br />
<input type="radio" name="id[3]" value="9" id="attrib-3-9" /><label for="attrib-3-9">25 Inch Square (+$10.00)</label>
<input type="radio" name="id[1]" value="1" id="attrib-1-1" /><label for="attrib-1-1">100% Cotton Broad Cloth 3.5 oz</label><br />
<input type="radio" name="id[1]" value="2" id="attrib-1-2" /><label for="attrib-1-2">100% Cotton Broad Cloth 4.5 oz (little heavier) (+$5.00)</label><br />
<input type="radio" name="id[1]" value="3" id="attrib-1-3" /><label for="attrib-1-3">100% Organic Cotton Knit (+$3.00)</label><br />
<h4 class="optionName back"><label class="attribsUploads" for="attrib-4-0">Upload Your Image</label></h4>
<div id="my-dropzone" class="dropzone">
<div class="fallback">
<input type="file" name="id[txt_4]" id="attrib-4-0" /><br />
</div>
</div>
<input type="hidden" name="upload_1" value="4" />
<input type="hidden" name="txt_upload_1" />
,這是我的JS文件:
Dropzone.autoDiscover = false;
$(document).ready(function() {
$("#my-dropzone").dropzone({
maxFiles: 2000,
url: "/localhost/",
autoProcessQueue: false,
acceptedFiles: 'image/*',
addRemoveLinks: true
});
})
我不想使用AJAX來提交,我只是希望能夠選擇一個圖像使用拖放(或點擊)。如果我從我的JS離開了網址,我得到一個錯誤......
所以,問題是 - 我在做什麼錯在這裏,我怎麼能得到這個職位看起來像:
名= 「ID [txt_4]」; filename =「bck1.jpg」
當我拖放一個名爲bck1.jpg的圖像?