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

File Path Copy/Paste

2 Answers 86 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Craig Tarr
Top achievements
Rank 2
Craig Tarr asked on 22 Oct 2010, 05:39 PM
I'm looking for a way to take the selected file in teh FileExplorer and grab it's file path and make it availble in the clipboard as a copy/paste.

If the file has been uploaded to a folder location like /Documents/Secured/Downloads/ and the file name is Fall2010.pdf. I want to be able to copy that full path including the filename and paste the text (not the actual file) into a text box in another window of my CMS tool.

I have a working solution using the zeroClipboard solution, Flash and jQuery. It works but several of my users are running into a problem where the computer clipboard is not updating and the copy of a new file path is failing. I've reinstalled Flash on those PC's and it's still very hit or miss.


Are there any methods already available in the FileExplorer that I may be overlooking? Has anyone implemented a different solution that works?


Looking closer at the tool, I see that the current folder path is displayed below the menu bar. But when I select a file the path doesn't update. That would be a good workaround if the path updated. I'll look at the docs and forum posts to see if I can do this.

2 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 27 Oct 2010, 02:59 PM
Hello Craig,

In general you can attach a handler to the RadFileExplorer's OnClientItemSelected event of the control and get the selected item:
<script type="text/javascript">
    function OnClientItemSelected(oExplorer, args)
    {
        var item = args.get_item();
        if (!item.isDirectory())
        {// the item is a file
            var filePath = item.get_path();
            var fileUrl = item.get_url();
 
            // Use the path..
            // ...
        }
    }
</script>

Please note that the browsers does not allow access to the clipboard from JavaScript (except IE) and you should implement the rest of the logic using some plugin.

Greetings,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Craig Tarr
Top achievements
Rank 2
answered on 28 Oct 2010, 01:57 PM
Works for me. We're limiting users to IE 7 or 8 so the JavaScript window.clipboardData will do fine. And this is an internal app so we don't have to worry as much about allowing the browser access to the clipboard.

Thanks
Tags
FileExplorer
Asked by
Craig Tarr
Top achievements
Rank 2
Answers by
Fiko
Telerik team
Craig Tarr
Top achievements
Rank 2
Share this question
or