我使用TinyMCE的4從例如圖像上載,並選擇圖像後上傳我收到「HTTP錯誤:404」消息。Tinimce 4圖像上載投擲HTTP錯誤:404
我測試過的例子postAcceptor.php與發佈圖像文件和它的作品。 上發佈圖片我收到JSON響應的結果:
{"location":"/home/mylogin/domains/mydomain.com/public_html/projects/projectname/img/gallery/422.jpg"}
這是否正確與那些多餘的斜線? 我的初始化代碼:
tinymce.init({
selector: 'textarea.content',
plugins: 'image code',
toolbar: 'undo redo | link image | code',
// enable title field in the Image dialog
image_title: true,
automatic_uploads: true,
images_upload_url: 'postAcceptor.php',
images_upload_base_path: '/img/gallery/',
images_upload_credentials: true,
file_picker_types: 'image',
// and here's our custom image picker
file_picker_callback: function(cb, value, meta) {
var input = document.createElement('input');
input.setAttribute('type', 'file');
input.setAttribute('accept', 'image/*');
input.onchange = function() {
var file = this.files[0];
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function() {
var id = 'blobid' + (new Date()).getTime();
var blobCache = tinymce.activeEditor.editorUpload.blobCache;
var base64 = reader.result.split(',')[1];
var blobInfo = blobCache.create(id, file, base64);
blobCache.add(blobInfo);
cb(blobInfo.blobUri(), { title: file.name });
};
};
input.click();
}
});
還是一樣。它改變了正常的URL,現在我得到: { 「位置」: 「HTTP:\/\ /本地主機\ /項目名稱\/IMG \ /畫廊\ /422.jpg」} –
什麼在編輯器中的圖像結束src何時處理?您通常不會在協議或主機名稱中包含返回值。 –
什麼都沒有。這只是這樣的:我選擇一個文件https://ibb.co/eQSuRa之後。 –