與自定義文件上傳的問題 - 從這裏http://codepen.io/wallaceerick/pen/fEdrz自定義文件上傳 - 刪除文件輸入字段
成功使用此代碼替換文件瀏覽器按鈕和樣式的預期上傳。 問題是,當使用它的代碼似乎刪除輸入字段,並在提交表格$_FILES
數組是空的?使用「瀏覽」,並從我的本地文件系統中選擇圖像時
- 形式是正確編碼(
enctype="multipart/form-data"
) - 標識的返回值
- 不使用JS包裝(如
$('#imageLogo').val()
返回文件名)文件輸入正確傳遞。
生成的代碼使用
<script>$('input[type=file]').customFile();</script>
<div class="custom-file-upload">
<div class="file-upload-wrapper">
<input type="file" name="logo_file" id="logoImage" class="custom-file-upload-hidden" tabindex="-1" style="position: absolute; left: -9999px;">
<input type="text" class="file-upload-input" title="a68a4029222401.55e8249a99c6b.jpg">
<button type="button" class="file-upload-button" tabindex="-1">Select a File</button>
</div>
</div>
在提交表單的文件元素是不可用的? ($_FILES
)輸出提交後。
array (size=0)
空
因此,似乎代碼被替換/刪除和形式,然後不知道該文件中的元素(即使我可以訪問原始
當我刪除JS調用運行這個(//$('input[type=file]').customFile();
)該文件現在可以在提交表單時正確顯示...? 任何幫助表示讚賞
你的PHP在哪裏? –