ckeditor – how to make simple uploader work

the line above will display the upload from whenever user click on the image icon.
the upload script should return
<script type="text/javascript">
window.parent.CKEDITOR.tools.callFunction(1, '<url of uploaded file>', '');</script>