0

I had kendo grid with inline editing. Now I want to add an upload images to 'propertyLogo' field. Basically, I use an editor function and call saveUrl: "indexHex.php, and fetch by PHP post method then convert to base64 and store into $imageHex variable.

In kendo Upload complete event, I load the php file and pass $imageHex to textbox. But somehow I get [obeject Object] in the textbox.

Any idea how I can fetch the $imageHex from indexHex.php

enter image description here

Here my sample in DOJO

my indexHex.php

if($_SERVER['REQUEST_METHOD']=='POST') {
 
 $file = $_FILES['fileUpload']; 
 $fileName = $_FILES['fileUpload']['name'];
 $fileTmpName = $_FILES['fileUpload']['tmp_name'];  //directory location 
 $fileSize = $_FILES['fileUpload']['size'];
 $fileError = $_FILES['fileUpload']['error'];  //default 0 | 1 got error
 
 $path = getcwd();
 $fileDestination = $path.'/uploads/'.$fileName;                    
 move_uploaded_file($fileTmpName, $fileDestination); 

 $data = file_get_contents($fileTmpName);
 $imageHex = base64_encode($data);
 
 echo $imageHex;
} 

This problem a almost similar with my previous question but with different approach.

  • That server response doesn't seems to be a valid base64 string. Check this out: https://www.geeksforgeeks.org/how-to-convert-an-image-to-base64-encoding-in-php/ look at the *output*. – DontVoteMeDown Jul 05 '19 at 12:43
  • Also, you should console the variable you're trying to set to the input's value. It is probably an object with a property that contains what you really wants. – DontVoteMeDown Jul 05 '19 at 12:45
  • I already change and server response to base64 string. But I still couldn't fetch the `$imageHex` variable. I think I need to use success event in kendo Upload to get server response in `indexHEx.php` but I do not know how to do. – dontbannedmeagain Jul 08 '19 at 00:22

0 Answers0