Immagini web

Buona domenica a tutti !
Spero non siate davanti al PC a sbraitare come st facendo io …

Ho necessit di caricare un file immagine anche con fileuplad,
Inserirla in un web canvas
eseguire poi il comando OCR
poi salvarla in un campo di database mysql per archiviarla

qui il mio codice …

  dim file as FolderItem
  dim i as Integer
  File = GetFolderItem("Uploads")
  if File.Exists = false then
    File.CreateAsFolder
  end if
  
  for i = 0 to files.Ubound
    File = File.Child(files(i).Name)
    Files(i).Save(File)
  next i
  
  Dim outputFile As FolderItem
  Dim output As BinaryStream
  Try
    
    // carico l'immagine nuova
    
    // search tessdata folder
    'dim fo as FolderItem = findfile("lingueocr")
    '
    'if TargetWin32 then 
    '// on Windows the parent folder
    'fo = fo.Parent
    'else
    '// path must be correct to have it find the files and point to folder where tessdata folder is inside
    'fo = GetFolderItem("") 
    'end if
    '
    'o = new TesseractMBS(fo, "ita")
    'dim n as integer = o.NumDawgs
    '
    'if n = 0 then
    'MsgBox "Non ho trovato i dati per la lingua OCR!"
    'quit
    'end if
    
    Dim f As FolderItem
    
    'show standard file selector
    f = File.Child(files(0).Name)
    if f=nil then
      
      exit sub           
    else
      
      nomefile = f
      
      // determino il tipo di immagine 
      
      dim pos as integer
      dim tipo as String
      pos = f.DisplayName.InStr(".")
      
      if(pos = 0) then
        
        exit sub
      end if
      
      tipo = f.DisplayName.Mid(pos+1)
      tipo = tipo.Lowercase
      
      select case tipo
        
      case "jpg","jpeg","jfif","jpe"
        formato = "jpg"
      case "png"
        formato = "png"
      case "pdf"
        #if TargetMacOS
          dim nomefilejpg AS string = f.ShellPath
          nomefilejpg = replace(nomefilejpg,".pdf",".tif")
          dim comando as string = "sips -s format tiff " + f.ShellPath + " --out " + nomefilejpg
          Dim sh As New Shell
          sh.Execute(comando)
          MsgBox(sh.Result)
          f = New FolderItem(nomefilejpg,FolderItem.PathTypeShell)
          formato = "tif"
        #elseif TargetWin32
          
          boxalert.messaggio("Impossibile caricare il file .pdf, questa funzione richiede MAC OS")
          exit sub
        #elseif TargetLinux
          
          boxalert.messaggio("Impossibile caricare il file .pdf, questa funzione richiede MAC OS")
          exit sub
        #endif
      case "gif"
        formato = "gif"
      case "bmp","dib"
        formato = "bmp"
      case "jfx","tif","tiff"
        #if TargetMacOS
          // 
          //boxalert.messaggio("Il formato TIF non  gestito su macos")
          formato = "tif"
        #elseif TargetWin32
          formato = "tif"
        #elseif TargetLinux
          formato = "tif"
        #endif
      case else
        exit sub
      end select
      
      immagine. = WebPicture(f)
      if documentooriginale <> nil then 
        'if documentooriginale.Depth > 1 then
        documentooriginale = BlackAndWhite(documentooriginale)
        'end if
        // imposto il livello di zoom 
        // ridisegno l'immagine
        magnifier = immagine.Width / documentooriginale.Width * 100
        immagine.Invalidate
        
        if o.SetImage(documentooriginale) then
          
          txtnote.text = o.getText
          
          'pic=p
          
        end if
        
        
        'if msgbox("Desideri eliminare l'immagine originale ? ",36,"Attenzione !") = 6 then
        'f.Delete
        'end if
      end if
    end
    
  Catch e As IOException
    exit sub
  End Try