I took a screenshot from an app and I wanted to paste the screenshot to the ticket.
There is a small "progress bar" rather than a spinning wheel - which means data is being uploaded....
but the image does not appear on the edited ticket's content :(
This is a redactor feature and should be addressed upstream with them (@jedikev @protich). In the meanwhile if you simply click the insert image icon and drag and drop the image you should have better luck.
Thanks for answer
I will try your solution soon.
Of course it works but I hope this will be fixed soon, as COPY PASTE images was one of the best feature in this HTML Editor.
I notice that I get this kind of error:
[INSERT INTO `ost_attachment` SET `file_id` = 6093, `type` = 'D', `object_id` = 15488, `name` = 'screenshot-NG9O']
Duplicate entry '15488-6093-D' for key 'file-type'<br />
<br />
---- Wsteczne 艣ledzenie ----<br />
#0 (g艂贸wny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (g艂贸wny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (g艂贸wny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (g艂贸wny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (g艂贸wny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (g艂贸wny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('15488')<br />
#7 (g艂贸wny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('15488/attach', Array)<br />
#9 (g艂贸wny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('15488/attach', Array)<br />
#10 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/15488/at...', NULL)<br />
#11 (g艂贸wny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/15488/at...')<br />
#12 {main}
But now this PASTE Image appears in editor.
I have the same error when copy paste image from clipboard (DB Error #1062). Can anyone solve for this?
Thank you
Me to:
DB Error #1062
[INSERT INTOost_attachmentSETfile_id= 112,type= 'D',object_id= 184,name` = 'screenshot-FfHO'] Duplicate entry '184-112-D' for key 'file-type'
---- Backtrace ----
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO o...')
#1 (root)/include/class.orm.php(3133): db_query('INSERT INTOos...', true, true)
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('184')
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('184/attach', Array)
#8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('184/attach', Array)
#9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/184/atta...', NULL)
#10 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/184/atta...')
#11 {main}`
Could you please describe your environment and osTicket version as I can not reproduce this issue.

Are you trying to copy and paste on that tablet/phone or on a computer?
No on a PC.. But i wasn't close tot my PC when your asked for more info. I want tot paste a received email from outlook with images inside the text. When i paste everything i see dubble "enter" lines and no images.
Ok, firstly I'm running CentOS 7 with Apache and osTicket v1.10(latest) and I'm able to paste images all day long with no errors. You need to explain your environment in more detail so we can further try to replicate that issue.
Secondly, we do not support pasting from a Word Document and keeping its format and attachments.
Is there an update on this issue? Find it hard to believe that such a key element is lacking in the editor for a support application. Please advise.
I am also getting this error. I am trying to paste images from the clipboard (screen grabs) they do not exist as files on my Windows PC, I just grab them with a screen grabber, copy the image to the clipboard and try and paste into the Editor (this worked fine with 1.8 which we were running previously to updating to 1.10)
Try to paste them several times.
This should works sometimes, at least it works in this way for my case.
Could you confirm that this works in this way ?
Thanks pasting twice does work.
I got same problem with v1.10-47-gb9f0937 (b9f0937), is there some fix ? - I have English pack installed only (default)
[INSERT INTO `ost_attachment` SET `file_id` = 331, `type` = 'D', `object_id` = 142, `name` = 'screenshot-lgbA']
Duplicate entry '142-331-D' for key 'file-type'<br />
<br />
---- Backtrace ----<br />
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (root)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 [internal function]: DraftAjaxAPI->uploadInlineImage('142')<br />
#7 (root)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)<br />
#8 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('142/attach', Array)<br />
#9 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('142/attach', Array)<br />
#10 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/142/atta...', NULL)<br />
#11 (root)/scp/ajax.php(262): Dispatcher->resolve('/draft/142/atta...')<br />
#12 {main}
Have noticed, if you past first then add your text it works every time.
It also works, if you past on the same line as the text you previously wrote. The editor automatically adds a break before the image (tested in Chrome and Firefox).
This doesn't work, if you already tried to spam the image into the editor before...
Big thanks this is just:
Eureka !!
Same problem
@balojs could you also confirm that @pespi123 solution works for you ?
@mlipok The above solution does not work for me.
I get the following error message as soon as I try to paste.

EDIT:
This particular error was caused by inadequate permissions on the php upload_tmp_dir. I changed it to C:temp in php.ini and then gave my apppool permissions to read and write to it. Now I am getting the same error as above.
Alright I think I see why this is happening.
In class.attachment.php in the upload function there is no checking to see if the image was already saved. So every time it tries to save it tries to insert the image again with the same file name that it generated before.
I added the following below line 157:
$existing = AttachmentFile::lookup($fileId);
if($existing != null) {
$i[] = $fileId;
continue;
}
Im certain that this isnt the best way to fix it but I dont know php.
This still doesnt help firefox but I think that is a javascript problem.
Also observing this behavior, has anyone identified a fix yet?
For me works @pespi123 solution.
I don't think that this is the true proper solution but it does work for me and I think it would point anyone who knows anything about Javascript to the true solution for this problem. Hope this helps.

Thanks for you findings.
Hope @JediKev will look here soon.
@mlipok, does @dbummy's solution work for you? I'm unable to replicate this issue so I need someone else to test this!
On first glance:
Yes it fix the issue - but no entirly.
I mean this is very useful fix which make it more user friendly as this starts to work.
But after quick testing there are situation when I still get errors like this:
[INSERT INTO
ost_attachmentSETfile_id= 8493,type= 'D',object_id= 90]
Duplicate entry '90-8493-D' for key 'file-type'---- Wsteczne sledzenie ----
0 (gl贸wny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')
1 (gl贸wny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
2 (gl贸wny katalog)/include/class.orm.php(597): MySqlExecutor->execute()
3 (gl贸wny katalog)/include/class.attachment.php(161): VerySimpleModel->save()
4 (gl贸wny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
5 (gl贸wny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
6 [internal function]: DraftAjaxAPI->uploadInlineImage('90')
7 (gl贸wny katalog)/include/class.dispatcher.php(145): call_user_func_array(Array, Array)
8 (gl贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('90/attach', Array)
9 (gl贸wny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('90/attach', Array)
10 (gl贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/90/attac...', NULL)
11 (gl贸wny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/90/attac...')
12 {main}
But I can confirm that this qucik fix help me a lot and is very helpfull.
Thanks @dbummy
@pespi123 said:
This doesn't work, if you already tried to spam the image into the editor before...
I can confirm that in @dbummy fix , the problem with multiple insterting the same Image is also fixed but, only if you paste it quickly multiple times.
So it seems as if the reason this happens is something that is not new knowledge. The comment just above where I made that change is:
(Line 964 in redactor-plugins.js)
// Capture the selection position every so often as Redactor seems to
// drop it when attempting an image paste before paste browser event
// fires
and it seems like it is just giving the cursor a vertical offset. When I applied the change, most of my work computers have been ok but when I checked it with my MacBook Pro, it had the same results as before (I'm guessing that it being a pixel offset and the Macbook having a much higher resolution, it didn't "land" where it was supposed to. I got some of the Database errors as well but they seem to have slowed down since this morning. I got about 5-8 first thing this morning and then I only got one more around 11ish (Central). I will continue to monitor and try other things to see if I can come up with a more elegant solution.
Thanks for your involvment @dbummy .
No problem. Glad I can help!
I'm using MariaDB (I've mushed osTicket with Snipe-IT to handle asset management) so I don't know if that has any influence on the error 1062 or not. I did add
'OLD_MODE' => 'NO_DUP_KEY_WARNINGS_WITH_IGNORE'
to /include/mysqli.php (around line 77) as described here: https://github.com/osTicket/osTicket/issues/3193
and I have not gotten any more 1062 errors (as of yet) and I have been paste happy all over testing. Seems like this has suppressed the error on my system but like I said, I am using MariaDB.

As I read the mariaDB manual NO_DUP_KEY_WARNINGS_WITH_IGNORE shouldn't help since it's not an INSERT IGNORE which causes the 1062 error
Interesting. I will continue to test. I still have not received any more with the change whereas yesterday by now I already had ~5-8 by this time. I will continue to test and see if I can further pick apart the redactor-plugins.js file (this is where I believe that the errors and weird issues are coming from) Thanks @fredricj !
Ok, I was going off of my emails and not off the logs for the 1062 errors and they are still showing up (guess my email got tired of sending them). I think that the pasting issue stems from Redactor trying to pick up where it left off after pasting the image. I have tried at a few different installations of 1.10 running on different OSs hitting "Enter" 10 times and then try to paste it messes up every time. Can someone verify that this is not true for all instances?
If anyone has any type of JS skills can you please look at redactor-plugins.js Lines 948 - 1072 and see if you can figure out what is going on before/after/during pasting an image from clipboard? Thanks!
I think the problem is when paste image after hit "Enter", if i type some character and paste image from clipboard without "Enter" i'm not get error DB Error #1062
I'm getting this too: fresh install (this morning!)

DB Error #1062
[INSERT INTO `ost_attachment` SET `file_id` = 14, `type` = 'D', `object_id` = 7] Duplicate entry '7-14-D' for key 'file-type'
---- Backtrace ----
#0 (root)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')
#1 (root)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)
#2 (root)/include/class.orm.php(597): MySqlExecutor->execute()
#3 (root)/include/class.attachment.php(161): VerySimpleModel->save()
#4 (root)/include/ajax.draft.php(101): GenericAttachments->upload(Array)
#5 (root)/include/ajax.draft.php(229): DraftAjaxAPI->_uploadInlineImage(Object(Draft))
#6 (root)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImageClient('7')
#7 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('7/attach', Array)
#8 (root)/include/class.dispatcher.php(120): Dispatcher->resolve('7/attach', Array)
#9 (root)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/7/attach', NULL)
#10 (root)/ajax.php(50): Dispatcher->resolve('/draft/7/attach')
#11 {main}
Sorry - I don't have the necessary JS skills to even understand the problem, let alone fix it....
I can confirm this error - migrated from 1.9.8.1 to 1.10.1 and when I paste image from clipboard after I hit "Enter" then I get "DB Error #1062" - can't paste image:
[INSERT INTO `ost_attachment` SET `file_id` = 6930, `type` = 'D', `object_id` = 46194]
Duplicate entry '46194-6930-D' for key 'file-type'<br /> <br />
---- Wsteczne 艣ledzenie ----<br />
#0 (g艂贸wny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (g艂贸wny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (g艂贸wny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (g艂贸wny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (g艂贸wny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (g艂贸wny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (g艂贸wny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46194')<br />
#7 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46194/attach', Array)<br />
#8 (g艂贸wny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46194/attach', Array)<br />
#9 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46194/at...', NULL)<br />
#10 (g艂贸wny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46194/at...')<br />
#11 {main}

Temporary solution is to type some characters after I hit Enter, and before I paste image.
Is there allready a solution for this issue? I have installed the latest version but still have this problem
Everyone, try this pull request and get back to me: https://github.com/osTicket/osTicket/pull/4113
Cheers.
Applied the new Redactor version from #4113 and image paste is now working on v1.10
When pasting images in one after another from Snipping Tool, it was pasting the image every other time but it was still pasting images in.
Installed changes from #4113 and problem with image pasting DB Error #1062 still exists:
[INSERT INTO `ost_attachment` SET `file_id` = 7073, `type` = 'D', `object_id` = 46325]
Duplicate entry '46325-7073-D' for key 'file-type'<br /> <br />
---- Wsteczne 艣ledzenie ----<br />
#0 (g艂贸wny katalog)/include/mysqli.php(204): osTicket->logDBError('DB Error #1062', '[INSERT INTO `o...')<br />
#1 (g艂贸wny katalog)/include/class.orm.php(3133): db_query('INSERT INTO `os...', true, true)<br />
#2 (g艂贸wny katalog)/include/class.orm.php(597): MySqlExecutor->execute()<br />
#3 (g艂贸wny katalog)/include/class.attachment.php(161): VerySimpleModel->save()<br />
#4 (g艂贸wny katalog)/include/ajax.draft.php(101): GenericAttachments->upload(Array)<br />
#5 (g艂贸wny katalog)/include/ajax.draft.php(300): DraftAjaxAPI->_uploadInlineImage(Object(Draft))<br />
#6 (g艂贸wny katalog)/include/class.dispatcher.php(145): DraftAjaxAPI->uploadInlineImage('46325')<br />
#7 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('46325/attach', Array)<br />
#8 (g艂贸wny katalog)/include/class.dispatcher.php(120): Dispatcher->resolve('46325/attach', Array)<br />
#9 (g艂贸wny katalog)/include/class.dispatcher.php(38): UrlMatcher->dispatch('/draft/46325/at...', NULL)<br />
#10 (g艂贸wny katalog)/scp/ajax.php(262): Dispatcher->resolve('/draft/46325/at...')<br />
#11 {main}
Sorry if I'm beating a dead horse here, but I've been trying to find a solution for quite a while. My configuration is shown below. I've tried the two fixes mentioned in this thread: upgrading redactor to 10.2.5, and changing Line 964 in redactor-plugins.js. When I upgrade redactor, the DB errors stop, but paste still doesn't function. When I change line 964 in redactor-plugins.js, the first paste works, but subsequent pastes do not, followed by a string of DB errors. Database errors shown below too.
Anyone have any other suggestions? It seems like redactor has been abandoned:

INSERT INTOost_attachmentSETfile_id= 2257,type= 'D',object_id` = 10]
Duplicate entry '10-2257-D' for key 'file-type'
---- Backtrace ----
`
@JediKev Are you considering switching to another WYSIWYG editor? (https://summernote.org /
https://quilljs.com / https://www.tinymce.com/ / https://ckeditor.com )
@Aka4Code if you want use tinymce, you can read this article http://osticket.com/forum/discussion/91133/plugin-tinymce.
Now, i use that and so far solve copy paste image problem
@JediKev so why you don't wont to replace Redactor with TinyMCE? Someone already made plugin and as @vieckzand said it's working with osTicket....
@Aka4Code I think the problem is size data in database when use TinyMCE as text editor to save image in text (image result from copy paste image). You can test what is different TinyMCE and Redactor.
I already test for the same text with same image if i use redactor i get small size rather than TinyMCE.
Thanks
@Aka4Code because we have totally different plans ahead for the text editor. I can't reveal these plans just yet but know changes are coming soon for the text editor. Cheers.
I hope this editor will stay.
Or at least new new version will have editor with the same feature - "easy" image/screenshot paste .
On each forum/helpdes which I know the main problem is that I must ATTACH image and can not just PASTE them, and this is non efective way to work with computers "messaging/communication" systems.
Remaining in hope and expectation,
mLipok
@mlipok
Trust me, attaching/pasting images will stay as easy as it is. The editor will just be way better, possibly have more features, and will _hopefully_ fix all the pasting issues seen recently. I'm glad most everyone is staying hopeful as we are putting a lot of work into the next few releases.
Cheers.
Thanks for your answer.
@JediKev your patch #4113 does fix the problem, thank you
@davidegiunchidiennea as you can read from last @JediKev response the DevTeam has taken a decision to change editor at all (as far as I understand @JediKev statement).
So be patient in waiting for new version.
@JediKev What's the status of this issue? Do you have any roadmap when you plan to release these changes in text editor?
@Aka4Code
We never have/promise timelines for anything as we are always working on 1,000 things at a time, but it's coming. New/replacement text editor will be added in/after version 2.0. No set release date or development date for this version as we are still trying to release 1.11.x. Please stay tuned.
Cheers.
@JediKev I'm sorry, I misunderstood your previous message:
I can't reveal these plans just yet but know changes are coming soon for the text editor.
I suppose if 1.11 is not yet ready, then version 2.0 and these changes in text editor will not come soon, at least not in next 2-3 years i predict :/ We have different understanding of coming soon statement I'm afraid.
Thank you for detailing, and that you prove me wrong, so I know whats real status of this issue.
Cheers.
@Aka4Code
Well we do not have set release or development dates so all I can ever say is soon so...yea.
Cheers.
I also do have the issues with copy+pasting a screenshot into the WYSIWYG editor.
However, I only experience the problem in Firefox (latest update but earlier versions as well).
In Internet Explorer or Chrome I don't have any problems.
I already tried updating scp.js & redactor.min.js with the informations provided by JediKev - but sadly I didn't help.
Is there any mandatory information about this issue regarding Firefox?
(The customer that uses osTicket is not able to install other browser so only FF or IE able).
Thank you very much!
@osTicketRocks this issue also exists in Chrome
@JediKev please remember about this bug, maybe next release it will be possible? 1.11 is great work!
btw.
I found that when I paste specyfic screenshot to ThunderBird email, and then copy them from ThunderBird then I have always no problem with pasting to osTicket.
@Aka4Code
I still cannot reproduce this error. I tried with Mac, Linux, and Windows (v1.10.4-5 and v1.11) and I'm able to paste every time I did notice that you cannot paste a screenshot from a localhost site as it's not a publicly accessible image nor an image from the computer itself.
Cheers.
We are using windows and Chrome browser. We have it inhere always. Never works. Myabe this info helps?
Our osTicket is not localhost - it's in publicly accessible hosting.
Image is pasted from clipboard - for example copied by Windows Snipping Tool
or from some graphic editor like Windows Paint.Net.
Tested with Chrome and Windows 10 1809.
Same behavior with 1.10 and 1.11.
@CashDesk
Unfortunately that does not help as I tested using the same and I'm able to paste.
@Aka4Code
I just tested using Windows Server 2016, Chrome (latest), and Snipping Tool and it works just fine:

Cheers.

This config helps anything? Can I deliver to you some other logs?
@Aka4Code
Thank you for that but it doesn't really help as I tested using osTicket hosted with NGINX, osTicket hosted with Apache, and osTicket hosted with IIS all let me paste images from Snipping Tool just fine. I'm not sure where the issue lies for you guys as it's working for me and the "errors" you guys post are not detailed errors, rather, error codes.
The only thing that will be helpful at this point is detailed error logs and an example image.
Cheers.
How can I help? From what source you want this logs? Image I can deliver. Logs also, but I need to know from where you want me to get them. Apache logs/php logs/mysql logs/osticket logs or something different?
@Aka4Code
Any errors that are related. Just make sure they have details and not just an error code.
Cheers.
still errors in 0.12 ( but it works if you past 2x )
Happens if you reply to a ticket email. Brand new install/setup. Actually don't think it's the same issue but a ticket with this issue was closed as a duplicate so...
[INSERT INTO ost_attachment SET type = 'H', object_id = 11, file_id = 1, inline = 1]
Duplicate entry '1-11' for key 'file_object'
---- Backtrace ----
I have the same problem, when I tried to paste a picture in email reply, I got this error:

@mlipok @vieckzand @Aka4Code @davidegiunchidiennea @osTicketRocks @CashDesk @thctlo @ebonweaver @sjxiong
The new/improved editor is released with v1.14-rc1 available here:
It is an RC so we do not recommend running in production. You may install a new instance to test copy/paste with the new editor. If you find any issues, please do a recursive search in this repo first to see if there is an issue created for it already and if not create you鈥檙e own issue report. Make sure to fill out the entire Issue Template for the best possible assistance.
Cheers.
For now I can confirm that this problem is not occuring any more from time when we install v1.14.x
I think if any other user (@vieckzand @Aka4Code @davidegiunchidiennea @osTicketRocks @CashDesk @thctlo @ebonweaver @sjxiong) confirm that this is fixed .... then this ticket can be closed.
When I upgraded to 1.14, it fixed this issue for me.
Upgrading to 1.14 solved the problem!
Running 14.1 now and yes.. solved.
Most helpful comment
It also works, if you past on the same line as the text you previously wrote. The editor automatically adds a break before the image (tested in Chrome and Firefox).
This doesn't work, if you already tried to spam the image into the editor before...