Web based solutions, tutorials, examples and help. 

  • Download Manager

 #777  by webslave
 Tue May 29, 2012 2:51 pm
Yeah that was kinda what I was getting at.
Example frontend side.
Front Page
- Directory 1 (click and loads directory, or opens an accordion with files within)
- Directory 2

I guess so it list the directories, with the files within. Or even just loads each directory
 #778  by Nito
 Tue May 29, 2012 3:20 pm
webslave wrote:Yeah that was kinda what I was getting at.
Example frontend side.
Front Page
- Directory 1 (click and loads directory, or opens an accordion with files within)
- Directory 2

I guess so it list the directories, with the files within. Or even just loads each directory


Yeah, you can just group them based on the child_dir column.
 #783  by Nito
 Thu May 31, 2012 6:11 pm
estrigliz wrote:hi, how can i remove uploaded files ? (whitout ftp or ssh)

best regards :)


I never actually added that (not sure how that got by me in the dev process, but oh well)..

Navigate to the admin/core/ directory, and open main-content.php

On line 39 you should see the following code:
Code: Select all<td<?=$editstyle;?>><a href="dashboard.php?go=edit&file=<?=$fetchDownloads->id;?>">Edit</a></td>


Create a new line underneath it, and add the following code:
Code: Select all<td<?=$editstyle;?>><a href="dashboard.php?go=delete&file=<?=$fetchDownloads->id;?>">Delete</a></td>


Create a new line after line 27, and add:
Code: Select all<th>&nbsp;</th> 


Now at the end of the file, create a line BEFORE the line that says "// End Switch", and paste one of the following codes in depending on if you used the revised version with child directories enabled:

If your downloads table HAS the column "child_dir":
Code: Select allcase 'delete':
        print '<table cellpadding="0" cellspacing="0" width="100%">';
        if(empty($_GET['file']) || !is_numeric($_GET['file'])) {
            $errflag=true;
        } else {
            if(mysql_num_rows(mysql_query("SELECT id FROM downloads WHERE filename = '".$_GET['file']."'")) == 0) {
                $flinkage=mysql_fetch_object(mysql_query("SELECT id,child_dir,filename FROM downloads WHERE id = '".$_GET['file']."'"));
                ($flinkage->child_dir=='')?($chidir=''):($chidir=$flinkage->child_dir.'/');
                $filename='../downloads/'.$chidir.$flinkage->filename;
                if(unlink($filename)) {
                    print 'File deletion was successful';
                } else {$errflag=true;}
            } else {$errflag=true;}
        }
        if($errflag){print '<tr><td class="non-public">Error.</td></tr>';}
        else{mysql_query("DELETE FROM downloads WHERE id='".$flinkage->id."'");}
        print '</table>';
    break; 


If your downloads table does NOT have the column "child_dir":

Code: Select allcase 'delete':
        print '<table cellpadding="0" cellspacing="0" width="100%">';
        if(empty($_GET['file']) || !is_numeric($_GET['file'])) {
            $errflag=true;
        } else {
            if(mysql_num_rows(mysql_query("SELECT id FROM downloads WHERE filename = '".$_GET['file']."'")) == 0) {
                $flinkage=mysql_fetch_object(mysql_query("SELECT id,filename FROM downloads WHERE id = '".$_GET['file']."'"));
                $filename='../downloads/'.$flinkage->filename;
                if(unlink($filename)) {
                    print 'File deletion was successful';
                } else {$errflag=true;}
            } else {$errflag=true;}
        }
        if($errflag){print '<tr><td class="non-public">Error.</td></tr>';}
        else{mysql_query("DELETE FROM downloads WHERE id='".$flinkage->id."'");}
        print '</table>';
    break; 


If you changed the downloads directory, you will need to edit accordingly. Let me know if there's any issues.