我的页面上有两个表单,一个用户可以上传图片,另一个用户可以重命名文件。第一个看起来像这样
{{ Form::open(array('url' => Request::url(), 'class'=>'dropzone',
'id' =>"my-awesome-dropzone", 'method' => 'post', 'files' => true)) }}
{{ Form::close()}}
第二个
{{ Form::open(array('url' => Request::url())) }}
{{ Form::text('name', null, array('id' => 'name', 'placeholder' => 'Name')) }}
{{ Form::submit('Upload', array('name' => 'upload-file')) }}
是否可以使用此提交来上传其他表单中的文件?
{{ Form::close() }}
这是js。我没有从php或js / jquery没有错误,文件根本没有上传,我不知道在哪里寻找错误或我做错了什么。还有另外一种方法吗?一些帮助将不胜感激。
$(function() {
Dropzone.options.myAwesomeDropzone = { // The camelized version of the ID of the form element
thumbnailWidth: 150,
thumbnailHeight: 150,
autoProcessQueue: false,
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 10,
// The setting up of the dropzone
init: function() {
var myDropzone = this;
// First change the button to actually tell Dropzone to process the queue.
document.querySelector("input[name=upload-file]").addEventListener("click", function(e) {
// Make sure that the form isn't actually being sent.
e.preventDefault();
e.stopPropagation();
myDropzone.processQueue();
});
this.on("addedfile", function(file) { $( "#form-width" ).show( "slow" );
$( "#form-rename" ).show( "slow" );});
// Listen to the sendingmultiple event. In this case, it's the sendingmultiple event instead
// of the sending event because uploadMultiple is set to true.
this.on("sendingmultiple", function() {
// Gets triggered when the form is actually being sent.
// Hide the success button or the complete form.
});
this.on("successmultiple", function(files, response) {
// Gets triggered when the files have successfully been sent.
// Redirect user or notify of success.
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
});
}
};
});