Page 1 of 1

saving image file to blob fields

Posted: Mon Jun 09, 2008 3:06 am
by fraxzi
Anybody...


I'm working on ADS71 (CDX) and this function always returns false...

db->( adsfiletoblob('file.bmp', 'field', 7) )

//'field' is image type defined in arc32
//7 means image or 6 means binary

I thought of changing table from CDX to ADT... and so.

still returns false.

I changed field type to binary... still CANT SAVE IMAGE FILE TO FIELD...


Code: Select all

If db->( dbRLock( recno() ) )

   if db->( adsfile2blob('d:\images\picture.bmp', 'MAP', 7) )
      msginfo('file image saved to table')
   else
     msginfo('unable to save')  
   end

end

anybody with the workaround is truly appreciated.


regards,

Posted: Mon Jun 09, 2008 7:54 am
by Antonio Linares
Frances,

This may be useful from Harbour ADS RDD docs:

<nBinaryType> Either ADS_BINARY (the default) or ADS_IMAGE. This parameter is for fields in DBF files. ADT tables cannot store binary and image data in standard character memo fields (they have specific field types for that).

Posted: Mon Jun 09, 2008 9:11 am
by fraxzi
Hello Mr. Antonio,

Thank you for the reply.

ADS_BINARY is 6 ands ADS_IMAGE is 7.

I used it in the third parameter (like the above) ADSFile2Blob('file','field',7)


I data type for 'field' is image or binary (ADT) but still not working...


Maybe there's problem with the wrapper ADSFile2Blob and, ADSBlob2File.


Anyone with a fix?


Regards,

Posted: Mon Jun 09, 2008 10:56 am
by Antonio Linares
Frances,

The C wrapper seems ok:

ulRetVal = AdsFileToBinary( pArea->hTable, (UNSIGNED8*)szFieldName, usBinaryType, (UNSIGNED8*)szFileName );

it returns a logical value. Do you get .T. or .F. ?

Posted: Mon Jun 09, 2008 3:08 pm
by fraxzi
Hello again Mr. Antonio,


The above coding returns .F. ( adsFile2blob() )...

Can I use the adsfilebinary() directly from xhb1.1/fivewin? If so how do you pass the parameter? adsfile2blob is much easier but I get .F. return.


Best regards,

Posted: Tue Jun 10, 2008 1:58 am
by fraxzi
OH MY GOD!!! I'M SO SORRY MR. ANTONIO...


The above is so true and correct! :lol:


my mistake was that the alias 'DB' is positioned EOF... :lol: :lol: :lol:


that is why the adsfile2blob is returning FALSE....



IT'S WORKING PERPECTLY.....


Regards to you Mr. Antonio :D