Hayden
Hayden

Reputation: 857

How do I configure a tinymce editor to only upload images to the server only on form submit?

I am creating a forum that utilizes the tinymce wysiwyg editor. It seems like the editor's default behavior is to upload an image to the server immediately when a user adds an image to the editor.

What if the user does not want that image anymore? What if a user maliciously adds many, many photos to the server?

I am wanting to submit images to the server only when a user submits a post. That way, I can limit the amount of images downloaded to the server and can better validate the post.

Upvotes: 2

Views: 1392

Answers (1)

Tiny Lincoln
Tiny Lincoln

Reputation: 1102

You can set the configuration setting automatic_uploads: false.

With that setting, as long as either images_upload_url or images_upload_handler are specified, images shouldn't be uploaded automatically and should only be uploaded when editor.uploadImages() is called upon form submission.

Here's some more information about automatic_uploads:

https://www.tiny.cloud/docs/configure/file-image-upload/#automatic_uploads

NOTE: Tiny has identified a bug where the automatic_uploads setting isn't always respected when uploading via the image dialog. The bug has been logged, and work to fix the bug is currently being scheduled as of this posting. I will edit this post the fix has been released.

Upvotes: 1

Related Questions