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

How save a uploaded image in a specified folder

2 Answers 587 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Ganesh
Top achievements
Rank 2
Ganesh asked on 04 Jun 2012, 02:26 PM
Hi,

I written the following line to upload images.

<div style="width: 45%">
        <input name="files" id="files" type="file" />
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#files").closest(".k-upload").find("span").css("width", "300px");
            $("#files").kendoUpload({
                localization: {
                    "select": "Upload New Image",
                    "cancel": "Cancel",
                    "retry": "Retry",
                    "remove": "Remove",
                    "uploadSelectedFiles": "Upload files",
                    "dropFilesHere": "drop files here to upload",
                    "statusUploading": "uploading",
                    "statusUploaded": "uploaded",
                    "statusFailed": "failed"
                },
                async: {
                    saveUrl: "here what?",
                    removeUrl: "remove",
                    autoUpload: true
                }
            });
       });
            
    </script>

I  have  two questions

1. can you explain about saveUrl? How to save a selected image in specified local drive folder?
2. How to show a selected image in img tag?

i couldn't find any example from download kit kendoui.complete.2012.1.515.trial
can any one please help about this kendo  upload

Thanks for you assistance

2 Answers, 1 is accepted

Sort by
0
April Nguyen
Top achievements
Rank 1
answered on 23 Aug 2012, 09:28 AM
Hi,
I have the same question. Does anyone have an answer for this ?
Regards,
April
0
T. Tsonev
Telerik team
answered on 24 Aug 2012, 03:42 PM
Hi,

Please refer to the documentation for an explanation on how async upload works.

The server handler ultimately decides what to do with the incoming file and where to save it. In order to display the image (or its thumbnail) you need to store it in a client-accessible location and return its URL as metadata. With the URL at hand you can inject an image in the DOM. For example:

function onUpload(e) {
    var imageUrl = e.response.previewUrl;
    if (imageUrl) {
        $("<img src='" + imageUrl + "' />").appendTo("#previewContainer");
    }
}


I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Upload
Asked by
Ganesh
Top achievements
Rank 2
Answers by
April Nguyen
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or