This is a migrated thread and some comments may be shown as answers.

Image Selector always shows 405 method not allowed

4 Answers 180 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Chen
Top achievements
Rank 1
Chen asked on 19 Jan 2015, 02:56 AM
Hi , I just use the sample editor HTML

and click insert image ,always shows 405 method not allowed 

how can i solve this problem??


<!DOCTYPE html>
<html>
<head>
    <title></title>
        <link rel="stylesheet" href="Content/kendo.common.css" />
    <link rel="stylesheet" href="Content/kendo.default.css" />
    <link rel="stylesheet" href="Content/kendo.dataviz.css" />
    <link rel="stylesheet" href="Content/kendo.dataviz.default.css" />
    <script src="Scripts/jquery-1.10.2.js"></script>
    <script src="Scripts/kendo.all.js"></script>
</head>
<body>
        <div id="example">
 
            <div class="box">
                <p>Allowed file types for the Image browser are: jpg, jpeg, gif, png</p>
                <p>Allowed file types for the File browser for this demo are: txt, doc, docx, xls, xlsx, ppt, pptx, zip, rar, jpg, jpeg, gif, png</p>
            </div>
 
            <textarea id="editor" rows="10" cols="30" style="height:440px">
     
                </textarea>
            <script>
                $(document).ready(function() {
                    // create Editor from textarea HTML element with default set of tools
                    $("#editor").kendoEditor({
                        tools: [
                            "insertImage",
                            "insertFile"
                        ],
                        imageBrowser: {
                           messages: {
                            dropFilesHere: "Drop files here"
                           },
                           transport: {
                                read: "/test/",
                                destroy: {
                                    url: "/test/",
                                    type: "POST"
                                },
                                create: {
                                    url: "/test/",
                                    type: "POST"
                                },
                                thumbnailUrl: "/test/",
                                uploadUrl: "/test/",
                                imageUrl: "/test?path={0}"
                           }
                        },
                        fileBrowser: {
                            messages: {
                                dropFilesHere: "Drop files here"
                            },
                            transport: {
                                read: "/kendo-ui/service/FileBrowser/Read",
                                destroy: {
                                    url: "/kendo-ui/service/FileBrowser/Destroy",
                                    type: "POST"
                                },
                                create: {
                                    url: "/kendo-ui/service/FileBrowser/Create",
                                    type: "POST"
                                },
                                uploadUrl: "/kendo-ui/service/FileBrowser/Upload",
                                fileUrl: "/kendo-ui/service/FileBrowser/File?fileName={0}"
                            }
                        }
                    });
                });
            </script>
        </div>
 
 
</body>
</html>

4 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Jan 2015, 08:10 AM
Hi Chen,

"Method not allowed" means that the client-side scripts are executing GET requests, while the server code expects a POST request, or vice-versa. Please verify.

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chen
Top achievements
Rank 1
answered on 22 Jan 2015, 12:57 AM
Hi Dimo 

ths for reply.

how can I change type from POST to GET??

I change the [type: "POST"] to [type: "GET"] , it's still get POST 405 method not allowed.


0
Chen
Top achievements
Rank 1
answered on 22 Jan 2015, 02:20 AM
Hi Dimo 

imageBrowser: {
     transport: {
        read: "/imagebrowser/read"
      }
}

the value of transport.read is a Web API??
if it is, is there any sample of the read , destroy and create Sample Code??
0
Dimo
Telerik team
answered on 23 Jan 2015, 03:44 PM
Hello Chen,

I am afraid we do not have an ImageBrowser example with a Web API. No matter what the server implementation is, you can configure the ImageBrowser's transport and schema to be compatible.

The request type can be changed, according to the documentation:

http://docs.telerik.com/kendo-ui/api/javascript/ui/editor#configuration-imageBrowser.transport.read.type

The request type can be set for all actions, in fact you are already doing this for most of them.

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Editor
Asked by
Chen
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Chen
Top achievements
Rank 1
Share this question
or