Based on the example of Mashy Package Manager I am trying to upload small images to the MySql DB. The image seems to be loaded from the html page but then you can't send it to php to save it in MySql.
I'm probably making mistakes, but which ones?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
The image I send is empty and gives me the error message
			
			I'm probably making mistakes, but which ones?
			
				B4X:
			
		
		
		Private Sub VFileInputLogo_Change (fileObj As Object)
    If banano.IsNull(fileObj) Or banano.IsUndefined(fileObj) Then Return
    VFileInputLogo.UpdateLoading(Page, True)
    Dim fileDet As FileObject
    fileDet = BANanoShared.GetFileDetails(fileObj)
    Dim fn As String = fileDet.FileName
  
    fileDet=BANanoShared.UploadFileWait(fileObj)
    Dim sstatus As String = fileDet.Status
  
    Select Case sstatus
        Case "error"
            vuetify.ShowSwalNotificationError($"file ${fn} non caricato"$,10000)
        Case "success"
            Dim res As String
            res = banano.CallInlinePHPWait("writeimegedb", CreateMap("table": "categorie","field":"logoRidotto","id":ID,"image":fileDet))
            vuetify.ShowSwalNotificationSuccess($"file ${fn} caricato: ${res}"$,3000)
    End Select
  
    VFileInputLogo.UpdateLoading(Page, False)
End Sub
	
			
				PHP CODE:
			
		
		
		function writeimegedb($table,$field,$id,$image) {
    $servername = "";
    $username = "";
    $password = "";
    $dbname = "";
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
  
        //check If File Is Not empty
        If(!empty($_FILES["image"]["name"])) {
            //File info
            $file_name = basename($_FILES["image"]["name"]);
            $file_type = pathinfo($file_name, PATHINFO_EXTENSION);
            //make an Array of allowed File extension
            $allowed_file_types = Array('jpg','jpeg','png','gif');
            ECHO "!";
            //check If upload File Is an image
            If( in_array($file_type, $allowed_file_types) ){
                $tmp_image = $_FILES['image']['tmp_name'];
                $img_content = addslashes(file_get_contents($tmp_image));
                //now run update query
                $query = $db->query("UPDATE ". $table. " SET ". $field. " = '$img_content' WHERE id=". $id);
                 //check If successfully inserted
                If($query){
                    echo "ok";
                }else{
                    echo "Something went wrong when uploading image!!!";
                }
            }else{
                echo "Only support jpg, jpeg, png, gif format";
            }
        } else {
            echo "Empty";
        }
      
    $conn->close();
 }
	The image I send is empty and gives me the error message
			
				Last edited: