0
我嘗試從選擇框中選擇文件夾,並從罰款上傳作爲參數發送請求。但發送null。我的代碼低於Rails罰款上傳選擇文件夾從選擇框
//haml codes
- path = "#{Rails.root}/public/templates/custom/"
- folders = Dir["#{path}*"]
%select#selected_path.form-control{name: 'folder'}
%option{disabled: "disabled", selected: "selected"} Select
- folders.each do |folder|
%option{value: "#{Rails.root + folder}"}
- if File.directory? folder
= folder
對於js代碼
$('#fine-uploader-gallery').fineUploader({
template: 'qq-template-gallery',
request: {
endpoint: '/admin/files/upload',
params: {
authenticity_token: "<%= form_authenticity_token %>",
// gecici path eklendi
selected_path: $('#selected_path').change(function() {
alert($('#selected_path option:selected').val());
$('#selected_path option:selected').val()
})
}
}
});
但上述selected_path PARAMS給我的錯誤。從js "selected_path"=>"[object HTMLSelectElement]"
返回錯誤,不是路徑。我該如何解決這個問題? 預先感謝您