Upload and save to Db Binary Files

  1. 3 weeks ago

    Alexis C

    Nov 16 Pre-Release Testers, Xojo Pro Puerto Rico, USA

    Hi
    if any example to upload a binary file and save it to the data base like PostgreSQL

    thanks

  2. Greg O

    Nov 16 Xojo Inc

    look in the examples for the file uploader example. Once the FilesUploaded event fires you just use a BinaryStream to read the content, possibly encode it (hex or base64) and then write the data to a field.

  3. Alexis C

    Nov 17 Pre-Release Testers, Xojo Pro Puerto Rico, USA

    ok
    Thanks

  4. Alexis C

    Nov 20 Pre-Release Testers, Xojo Pro Puerto Rico, USA

    This is the code i use for Picture but what have to change for binary files
    I am a litter confuse with web file upload

    Dim imageData as String
    Dim Rs As RecordSet
    Dim Db As DatabaseRecord
    Dim bs as BinaryStream
    Dim f as FolderItem
    Dim p as picture


    If p <> NIL and droppicture <> Nil then //<< == (but hire is empty )
    f = SpecialFolder.Temporary.Child( "Temp_Image.jpg" )
    p.Save(f,0,-1)
    bs=BinaryStream.Open(f,False)
    If bs <> NIL then
    imageData = bs.read(bs.length )
    bs.close
    Db.BlobColumn("Foto") = imageData
    End if

or Sign Up to reply!