implemented download single file from file menu

This commit is contained in:
Arthur Schiwon 2011-04-18 16:59:30 +02:00
parent 5a11e739b4
commit 4ae158bbe0
2 changed files with 9 additions and 2 deletions

View file

@ -49,6 +49,14 @@ $(document).ready(function() {
} }
}); });
// Download current file
$('#download_single_file').click(function() {
filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text();
window.location='ajax/download.php?files='+filename+'&dir='+$('#dir').val();
$('#file_menu').slideToggle(250);
return false;
});
// Delete current file // Delete current file
$('#delete_single_file').click(function() { $('#delete_single_file').click(function() {
filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text(); filename = $('#file_menu').parents('tr:first').find('.filename:first').children('a:first').text();
@ -121,7 +129,6 @@ $(document).ready(function() {
}); });
files=files.substr(1);//remove leading ; files=files.substr(1);//remove leading ;
//send the browser to the download location
$.ajax({ $.ajax({
url: 'ajax/delete.php', url: 'ajax/delete.php',
data: "dir="+$('#dir').val()+"&files="+files, data: "dir="+$('#dir').val()+"&files="+files,

View file

@ -38,7 +38,7 @@ name="file_upload_target" src=""></iframe></form>
<div id="file_menu"> <div id="file_menu">
<ul> <ul>
<li><a href="" title="">Download</a></li> <li><a href="" title="" id="download_single_file">Download</a></li>
<li><a href="" title="">Share</a></li> <li><a href="" title="">Share</a></li>
<li><a href="" title="" id="delete_single_file">Delete</a></li> <li><a href="" title="" id="delete_single_file">Delete</a></li>
</ul> </ul>