我正在使用此迷你版本的JQuery文件上传器:
https://tutorialzine.com/2013/05/mini-ajax-file-upload-form
但是,当有人单击上传按钮时,我需要他们能够输入要上传的标题。
我目前可以在Chrome台式机和iPhone Safari上使用它,但是由于某些原因它不能在iPhone chrome上使用,所以也许我做错了什么?
这是文件上传JQuery:
// Initialize the jQuery File Upload plugin
$('#upload').fileupload({
// This element will accept file drag/drop uploading
dropZone: $('#drop'),
maxNumberOfFiles: 1,
// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function (e, data) {
//This prompts the user to enter a title.
data.files[0].filetitle = window.prompt("Enter a Name for This Job", data.files[0].name);
var tpl = $('<li class="working"><input type="text" value="0" data-width="48" data-height="48"'+
' data-fgColor="#0788a5" data-readOnly="1" data-bgColor="#3e4043" /><p></p><span></span></li>');
// Append the file name and file size
tpl.find('p').text(data.files[0].name)
.append('<i>' + formatFileSize(data.files[0].size) + '</i>');
// Add the HTML to the UL element
data.context = tpl.appendTo(ul);
// Initialize the knob plugin
tpl.find('input').knob();
// Listen for clicks on the cancel icon
tpl.find('span').click(function(){
if(tpl.hasClass('working')){
jqXHR.abort();
}
tpl.fadeOut(function(){
tpl.remove();
});
});
// This adds the title to the form for submission as well as creates the action.
data.formData = {action : 'process_uploads',filetitle: data.files[0].filetitle};
var jqXHR = data.submit();
},
我添加的行首先是此行,以提示最终用户输入其标题:
data.files[0].filetitle = window.prompt("Enter a Name for This Job", data.files[0].name);
然后将输入的文本添加到提交的表单中
data.formData = {action : 'process_uploads',filetitle: data.files[0].filetitle};
有什么办法可以在移动Chrome浏览器上运行,或者这里还有其他问题吗?