error on duplicate check

  • Thread starter Mattijs van Ommeren
  • Start date
M

Mattijs van Ommeren

Guest
Hello I use dadabik 2.2.1.
All works fine, except one thing:
when I have 2 image fields, and I insert a record in the database and the filename that I choose for the images is the same, I get the following error:

Warning: Unable to open '/home/sites/www.blabla.be/web/database/uploads/dadabik_tmp_file_test_2.jpg' for reading: No such file or directory in /home/.sites/31/site63/web/database/admin/include/business_logic.php on line 1117


the record does insert correctly though, and the files get uploaded.

So it does not accept the same file name more than once in the same insert record statement??
 
P

PLMresearch

Guest
Check this out, http://www.dadabik.org/forum/read.php?f=1&i=1045&t=978#reply_1045 , I think it will address your problem.

Curious what are you running windoz or *nix?
 
P

PLMresearch

Guest
I _think_ this problem occurs on *nix systems. I experienced it on Free BSD. I _don't think_ it occurs on Widoz.
 
M

Mattijs van Ommeren

Guest
Exactly what do I have to replace in business logic?
Could you please tell me?

it now reads:

case "generic_file":
case "image_file":
$name_field_temp = $fields_labels_ar[$i]["name_field"];
$file_name = $HTTP_POST_FILES["$name_field_temp"]['name'];

if ($file_name != '') {
$file_name = get_valid_name_uploaded_file($file_name);
}

$sql .= "'".$file_name."', "; // add the field value to the sql statement

if ($file_name != '') {
// rename the temp name of the uploaded file
copy ($upload_directory.'dadabik_tmp_file_'.$file_name, $upload_directory.$file_name);
unlink($upload_directory.'dadabik_tmp_file_'.$file_name);
} // end if
break;
 
M

Mark

Guest
What version of Dadabik are you running. My fix is for version2.2.1 released _not_ version 2.2.1 beta.
 
P

PLMresearch

Guest
I think this is correct, however, I would strongly suggest using 'Beyond Compare' (http://www.scootersoftware.com/) to figure out what's different.


if ($file_name != '') {


Change this -> $file_name = get_valid_name_uploaded_file($file_name);

to this -> $file_name_new = get_valid_name_uploaded_file($file_name);


}

Change this -> $sql .= "'".$file_name."', "; // add the field value to the sql statement

to this -> $sql .= "'".$file_name_new."', "; // add the field value to the sql statement

if ($file_name != '') {
// rename the temp name of the uploaded file
copy ($upload_directory.'dadabik_tmp_file_'.$file_name,

Change this -> $upload_directory.$file_name);
to this -> $upload_directory.$file_name_new);

Change this -> unlink($upload_directory.'dadabik_tmp_file_'.$file_name);
to this -> // rename the temp name of the uploaded file
copy ($upload_directory.'dadabik_tmp_file_'.$file_name,
unlink($upload_directory.'dadabik_tmp_file_'.$file_name);

} // end if
break;
 
Top