업로드 버튼에 자신 만의 JQuery/Angular/Whatever 이벤트를 생성하고 데이터로 서버에 Ajax 호출을 보내십시오. JQuery를 사용하여 입력에서 데이터를 가져 와서 here과 같이 양식 처리 컨트롤러로 보낼 수 있습니다.
<input type="file" name="file" id="file" required />
귀하의 JS는 JQuery와 트리거 아래와 같이 Ajax 호출을하기 위해 별도의 JQuery와 기능을 포함합니다 :
이 당신의 입력하자.
tinymce.init({
selector: 'textarea',
height: 500,
toolbar: 'mybutton',
menubar: false,
setup: function (editor) {
editor.addButton('mybutton', {
text: 'My button',
icon: false,
onclick: function() {
//Trigger Submit event on input
$("#uploadimage").trigger('submit');
}
});
},
content_css: [
'//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',
'//www.tinymce.com/css/codepen.min.css'
]
});
//Triggered on submit
$("#uploadimage").on('submit',(function(e) {
e.preventDefault();
$("#message").empty();
$('#loading').show();
$.ajax({
url: "ajax_php_file.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
$('#loading').hide();
$("#message").html(data);
}
});
}));
CI 양식 업로드 라이브러리를 사용하여 업로드 된 파일을 처리 할 수있는 컨트롤러를 만듭니다. 솔직히 나는 TinyMCE보다 Froala를 더 좋아합니다. 왜냐하면이 멋진 작은 것들이 미리 알아내어졌고 아마도 더 많은 기능을 가지고 있으며 피부로 덮일 수 있기 때문입니다. 뭐든간에 당신 염소 남자가 떠 다닙니다. 이 방법이 효과가 있는지 알려주세요. 나는 방금이 코드를 그 자리에 놓았고 꽤 게으른 편이었다. TinyMCE init에서 폼 핸들링 함수를 움직일 수 있습니다. 건배!
실제로 사용자 권한이 올바르게 설정되어 있으면 파일 시스템의 어느 위치에서나 설정할 수 있습니다. – Tom