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

Simple file upload not working

4 Answers 2521 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Tayger
Top achievements
Rank 1
Iron
Tayger asked on 12 Apr 2017, 06:13 PM

Hello 

I'm pretty sure I'm doing something wrong but I just don't see what. Any file upload runs into an error but doesn't say what the problem is. I'm using this code based on your documentation:

$("#selectfile").kendoUpload({
    async: {
        saveUrl: "http://localhost/geoneers/gallery/image",
        removeUrl: "http://localhost/geoneers/save"
    },
    dropZone: ".dropfile",
    error: function (e) {
        var files = e.files;
 
        if (e.operation == "upload") {
            console.log (e);
            alert("Failed to upload " + files.length + " files");
        }
    },
    success: function(e) {
        alert ("success");
    }
});

 

It always runs into the error event showing me that all is fine (console.log(e); -> see attachment e_output). Beside of that kendo.all.js (line 2096) gives this output in into the console: 

[Log] Server response: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> (kendo.all.min.js, line 25)
<html>
 <head>
  <title>Index of /geoneers/gallery/image</title>
 </head>
 <body>
<h1>Index of /geoneers/gallery/image</h1>
<ul><li><a href="/geoneers/gallery/"> Parent Directory</a></li>
</ul>
</body></html>

I have not clue whats going wrong here. I'm working an a Mac and working with Mamp Pro (latest version). To get rid off the error I tried the following as well:

- Updated to the latest version of Kendoui Pro 
- Made sure the path is set to chmod 777

Wether I use "Select file..." or dropzone it always comes to this behaviour and the file is not uploaded.

Any ideas why?

Regards

 

 

 

4 Answers, 1 is accepted

Sort by
0
Tayger
Top achievements
Rank 1
Iron
answered on 12 Apr 2017, 06:23 PM
Further more I don't get the point of configuration parameter "removeUrl" beside of "saveUrl". It's not clear to me in the documentation. Either you wanna upload files or delete them. So why defining them for the same operation? Is the "removeUrl" needed for temp file handling? What is a valid reason to define and use "removeUrl"? Why should the path for removeUrl differ from saveUrl (as seen in your documentation examples).
0
Tayger
Top achievements
Rank 1
Iron
answered on 13 Apr 2017, 10:29 AM

 

Ummm, the problem seems to be solved. There is a file handler required on server side, good PHP example: http://www.telerik.com/forums/examples-of-async-saveurl-datahandlers

The documentation is (for me) misleading: http://docs.telerik.com/kendo-ui/api/javascript/ui/upload

All samples use a path for saveUrl and removeUrl what made me thinking that the Upload widget is uploading directly to that path.But the meaning here probably is that the last element in the path should represent the filehandler (save, remove). That is really misleading and should imho be made sure in the documentation.

0
Accepted
Ivan Danchev
Telerik team
answered on 14 Apr 2017, 05:31 AM
Hello,

We are glad you managed to fix the issue. In the information about the removeUrl configuration option in the API documentation we mention that this is the URL of the handler. Our demos also demonstrate this, for example see the Sample service in the HTML5/JavaScript source section of this demo, which shows both the "save" and "remove" handlers.

Regards,
Ivan Danchev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Tayger
Top achievements
Rank 1
Iron
answered on 14 Apr 2017, 09:35 AM

Hi Ivan

Thank your for sorting this out. It was just misleading to me just because all of your mentioned file handlers have no extension. So that way it could easily be seen as file path. Furthermore "file handler" is not mentioned in http://docs.telerik.com/kendo-ui/api/javascript/ui/upload at all where a developer is looking first to get familiar with Upload.

 

Tags
Upload
Asked by
Tayger
Top achievements
Rank 1
Iron
Answers by
Tayger
Top achievements
Rank 1
Iron
Ivan Danchev
Telerik team
Share this question
or