Skip to content

Commit 84b38f1

Browse files
committed
adding file field into array passed to callback function
1 parent 6d74ded commit 84b38f1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ajaxCRUD.class.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,12 @@ function doAction($action){
934934
$submitted_value_cleansed = $_REQUEST[$field];
935935
}
936936

937+
if ($uploads_on){
938+
if ($this->fieldInArray($field, $this->file_uploads)){
939+
$submitted_value_cleansed = $_FILES[$field]["name"];
940+
}
941+
}
942+
937943
$submitted_values[] = $submitted_value_cleansed;
938944
//also used for callback function
939945
$submitted_array[$field] = $submitted_value_cleansed;
@@ -1286,7 +1292,6 @@ function showTable(){
12861292
if (isset($_REQUEST['action'])){
12871293
$action = $_REQUEST['action'];
12881294
}
1289-
//print_r($this->exactSearchField);
12901295
foreach ($this->fields as $field){
12911296
//this if condition is so MULTIPLE ajaxCRUD tables can be used on the same page.
12921297
if ($_REQUEST['table'] == $this->db_table){

examples/example3.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#allow picture to be a file upload
7272
$tblFriend->setFileUpload('fldPicture','uploads/','uploads/');
7373
//$tblFriend->disallowEdit("fldPicture");
74+
$tblFriend->onAddExecuteCallBackFunction("myFunctionAfterAdd");
7475

7576
#format field output
7677
$tblFriend->formatFieldWithFunction('fldOwes', 'addDollarSign');
@@ -187,6 +188,10 @@ function addDollarSign($val) {
187188
function displayImage($val){
188189
return "<img src=\"uploads/$val\" width=\"90\">";
189190
}
191+
192+
function myFunctionAfterAdd($array){
193+
//print_r($array);
194+
}
190195
?>
191196

192197
</body>

0 commit comments

Comments
 (0)