Simple file upload not working

5 posts, 1 answers
  1. Tayger
    Tayger avatar
    191 posts
    Member since:
    Jan 2015

    Posted 12 Apr 2017 Link to this post

    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

     

     

     

  2. Tayger
    Tayger avatar
    191 posts
    Member since:
    Jan 2015

    Posted 12 Apr 2017 Link to this post

    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).
  3. Tayger
    Tayger avatar
    191 posts
    Member since:
    Jan 2015

    Posted 13 Apr 2017 in reply to Tayger Link to this post

     

    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.

  4. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    2061 posts

    Posted 14 Apr 2017 Link to this post

    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.
  5. Tayger
    Tayger avatar
    191 posts
    Member since:
    Jan 2015

    Posted 14 Apr 2017 in reply to Ivan Danchev Link to this post

    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.

     

Back to Top