Dmitry
11-16-2011, 10:56 AM
Hi everyone,
I am having a little issue with sorting file names in a drop down box by date. At the moment the files are arranged in a random manor and its not easy trying to find the right file you are looking for.
We have a website that was designed and coded by a company that no longer exists so they can't help us any longer. The backend of the site is designed to manage products, create/delete and etc etc. Before, when we went to add a new product, it would give us a dropdown box with all the images on the server sorted by date, now since we moved servers, it no longer does this.
So I was wondering if there is something I need to do or maybe change in the coding?
This is the code snippet:
$sServerDir = GetRootPath() . $Config['ProductHiresFilesPath'];
@$oCurrentFolder = opendir( $sServerDir ) ;
while ( @$sFile = readdir( $oCurrentFolder ) )
{
if ( $sFile != '.' && $sFile != '..' && !is_dir( $sServerDir . '/' . $sFile ) )
{
echo "
<option value='$sFile' ".(($row->product_hires_file == $sFile)?"selected='selected'":'').">$sFile</option>\n";
}
}
Any help is appreciated!
I am having a little issue with sorting file names in a drop down box by date. At the moment the files are arranged in a random manor and its not easy trying to find the right file you are looking for.
We have a website that was designed and coded by a company that no longer exists so they can't help us any longer. The backend of the site is designed to manage products, create/delete and etc etc. Before, when we went to add a new product, it would give us a dropdown box with all the images on the server sorted by date, now since we moved servers, it no longer does this.
So I was wondering if there is something I need to do or maybe change in the coding?
This is the code snippet:
$sServerDir = GetRootPath() . $Config['ProductHiresFilesPath'];
@$oCurrentFolder = opendir( $sServerDir ) ;
while ( @$sFile = readdir( $oCurrentFolder ) )
{
if ( $sFile != '.' && $sFile != '..' && !is_dir( $sServerDir . '/' . $sFile ) )
{
echo "
<option value='$sFile' ".(($row->product_hires_file == $sFile)?"selected='selected'":'').">$sFile</option>\n";
}
}
Any help is appreciated!