Page 1 of 1
[SOLVED]THUMBS.DB
Posted: Tue May 17, 2005 10:51 am
by rubberjohn
i am developing a site that relies on the only contents of a folder to be uploaded images, is there a way to stop this file being added?
if not what is the best way i can make sure it is removed regularly?
thanks
Posted: Tue May 17, 2005 11:19 am
by Burrito
sure, just filter it out of your upload list when you use readdir or glob.
Posted: Tue May 17, 2005 12:14 pm
by Todd_Z
instead of filtering out thumbs.db:
Code: Select all
if ( $file != "thumbs.db" ) uploadFile($file);
make sure all the files you are uploading are what you want, for example by extension, etc.
If you only filter out the thumbs.db files, then you are going to upload files that you don't want to by other names.
Posted: Tue May 17, 2005 2:01 pm
by Chris Corbyn
Don't forget to filter out "." and ".." too

Posted: Tue May 17, 2005 3:55 pm
by timvw
In that case you probably end up with an array
Code: Select all
$ignore = array('.', '..', 'thumbs.db');
And then it's only a matter of finding the right
http://www.php.net/array function to filter those out...
Posted: Tue May 17, 2005 5:05 pm
by Todd_Z
Code: Select all
$ignore = array('.', '..', 'thumbs.db');
$files = /* Function to read folder for all files */
$validFiles = array_diff( $ignore, $files );
uploadFiles( $validFiles );
thanks
Posted: Thu May 19, 2005 5:04 am
by rubberjohn
cheers thats been a big help