Facebook 

SMFHacks.com - Celebrating 20 Years!

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4342
Latest: eva
New This Month: 3
New This Week: 1
New Today: 1
Stats
Total Posts: 44312
Total Topics: 7676
Most Online Today: 513
Most Online Ever: 27044
(May 30, 2026, 09:10:16 pm)
Users Online
Members: 0
Guests: 327
Total: 327

Author Topic: Sorted FTP Import Directory  (Read 7793 times)

0 Members and 1 Guest are viewing this topic.

Sorted FTP Import Directory
« on: »
This is by far no way perfect, it was a quick hack, but it seems to work.  Please give this a look over.  Modified code in Themes/default/Downloads2.1.template.php around line 5066

Code: [Select]
// Check to see if there's anything in my special array.
if (isset($myFileArray))
if (count($myFileArray) > 0)
unset($myFileArray);

// Create a new array.
$myFileArray = array();

// Dump the contents of the directory into the new array...
// Loop through all the images in the folder.
$dir = opendir($fpath);
$count = 0;
while ($file = readdir($dir))
{
// Skip the directories!
if (!is_dir($fpath . '/' . $file))
{
$myFileArray[] = $file;
$count ++;
}
}
closedir($dir);

natcasesort($myFileArray);

// Now let's list these files.
// Loop though all the images in the folder
foreach ($myFileArray AS $fkey => $fvalue)
echo '
<tr>
<td><input type="checkbox" name="fimage[]" checked="checked" value="',$fvalue,'" /></td>
<td><a href="',$modSettings['down_url'], $fpath2 ,'/', $fvalue,'" target="_blank">',$fvalue,'</a></td>
<td>',Downloads_format_size(filesize($fpath . '/' . $fvalue),2),'</td>
</tr>';

-- Senkusha
Creative Pioneer exploring anime role playing adventures!
Visit my Creative Anime Role Playing Community
SMF 2.1.4
Like Like x 1 View List

Re: Sorted FTP Import Directory
« Reply #1 on: »
Looks good I would do something similar.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
4 Replies
6315 Views
Last post January 28, 2007, 12:45:35 pm
by phocas
3 Replies
7425 Views
Last post July 08, 2007, 05:52:16 pm
by SMFHacks
2 Replies
6260 Views
Last post January 18, 2008, 08:35:11 pm
by SMFHacks
1 Replies
8886 Views
Last post February 16, 2008, 11:53:55 am
by SMFHacks
9 Replies
10522 Views
Last post November 30, 2010, 09:19:56 pm
by SMFHacks

+- Recent Topics

Registration - anti bot pattern matching by SMFHacks
November 01, 2026, 07:20:17 pm

EZPortal 8 by davejo
October 21, 2026, 01:01:54 pm

Downloads Pro 7.0 Released by SMFHacks
October 07, 2026, 07:35:30 pm

[Mod]ActivityPub Federation for SMF 2.1 by SMFHacks
October 01, 2026, 05:03:45 pm

Newsletter Pro 4.0 Released by SMFHacks
September 23, 2026, 08:08:24 pm

Can't remove or restore any item from the recycle bin by SMFHacks
September 22, 2026, 11:01:51 am

MCP Server for SMF 2.1 - let Claude, ChatGPT or Cursor run your admin chores by SMFHacks
September 12, 2026, 02:50:45 pm

Suggestions for improvements to Ultimate Shoutbox & Chatroom by davejo
September 02, 2026, 01:35:09 am

Automatic Sorting of Categories by Kiwi
August 31, 2026, 12:36:09 am

' appears as &#39; in Most Viewed (and Recent Items ?) by SMFHacks
August 22, 2026, 11:01:56 pm

Powered by EzPortal