🔥 بلک‌فرایدی راکت: ۷۰٪ تخفیف روی همه دوره‌ها | سالی یک بار. وقتی تایمر صفر بشه، قیمت‌ها برمی‌گرده

مشاهده دوره‌ها
ثانیه
دقیقه
ساعت
روز
راکت

آپلود عکس در tiny mce

بدون پاسخ

سلام دوستان.
من از tiny mce برای آپلود عکس استفاده کردم.

tinymce.init({
            selector: 'textarea#tiny',
            directionality: 'rtl',
            plugins: ["link", "code", "table", "media", "image", "textcolor", "emoticons", 'image code'],
            automatic_uploads: true,
            paste_data_images: true,
            file_picker_types: 'image',
            images_upload_url: 'upload.php',
            plugins: 'preview link image  code table emoticons textcolor numberlist codesample lists media lists advlist directionality',

            // override default upload handler to simulate successful upload
            images_upload_handler: function(blobInfo, success, failure) {
                var xhr, formData;

                xhr = new XMLHttpRequest();
                xhr.withCredentials = false;
                xhr.open('POST', 'upload.php');

                xhr.onload = function() {
                    var json;

                    if (xhr.status != 200) {
                        failure('HTTP Error: ' + xhr.status);
                        return;
                    }

                    json = JSON.parse(xhr.responseText);

                    if (!json || typeof json.location != 'string') {
                        failure('Invalid JSON: ' + xhr.responseText);
                        return;
                    }

                    success(json.location);
                };

                formData = new FormData();
                formData.append('file', blobInfo.blob(), blobInfo.filename());

                xhr.send(formData);
            }
        });

کد بالا مربوط هست به جاوااسکریپتم عکس در به لطف php درست آپلود میشه در پوشه درست ولی توی فضای ادیتور عکس نمایش داده نمیشه و ارور زیر رو میده:
Cannot read properties of undefined (reading 'then')
خیلی ممنون میشم اسکریپ درست رو به من بگید

ثبت پرسش جدید

پاسخ‌ها

0

هنوز پاسخی ثبت نشده

اولین نفری باشید که به این پرسش کمک می‌کند و مسیر حل مشکل را باز می‌کند.

اولین پاسخ را بنویسید

برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام