Hi
This error occurs on a 3.0 project.
I have a table for users to upload their files. The table is a detail table to the user master table.
Each record has one field "filename" defined as Document Download/Document Upload field plus a few text fields qualifying the file.
The Folder where the file resides is defined as below the phprunner directory at "../lingfilesup" (I have tested it as a folder in the phprunner directory and the error still occurs).
If having created a record and uploaded a file, you then edit the record and for the filename field select "Delete..." from "Keep", "Delete..." "Update" to delete the file (but not the record), Save the changes thereby deleting the file from the server, then the record is listed with a blank field for the filename.
Fine everything working so far...
However, if you then select that RECORD for deletion in the _list.php page a PHP error occurs:
Technical information
Error type 2
Error description unlink(lingfilesup/) [function.unlink]: Is a directory
URL a-o.co.uk/phprunner/linguists/ling_files_up_list.php?
Error file /homepages/3/d22482688/htdocs/ao/phprunner/linguists/include/ling_files_up_functions.php
Error line 1718
SQL query delete from `ling_files_up` where (`files_id`=294) and (`ling_files_up`.`userid`=920)
This error ALWAYS occurs. I am aware that in the _list.php files, when deleting only owned records it checks to delete associated uploaded files if any.
The php error points to the "@unlink(GetUploadFolder($field).$value);" line in the following block of code in ling_files_up_functions.php:
function DeleteUploadedFiles($where)
{
global $conn,$strOriginalTableName;
$rs = db_query("select * from ".AddTableWrappers($strOriginalTableName)." where ".$where,$conn);
if($data=db_fetch_array($rs))
{
foreach($data as $field=>$value)
{
if(GetEditFormat($field)==EDIT_FORMAT_FILE)
@unlink(GetUploadFolder($field).$value);
}
}
}
Is this something I am doing wrong or is it a bug? Any help would be appreciated.
Many thanks in advance.