Hey John, 2011/2/7 John Robson <[email protected]>: > Hi everyone, > > I would like to save an Uploaded image to the database. > > 1) How can I create a BLOB (Binary Data Types) in PostgreSQL (bytea) > using Wt::Dbo ? > > I tried: char * picture; and std::vector<char*> picture;
The following should work: std::vector<unsigned char> See also: http://www.webtoolkit.eu/wt/doc/reference/html/structWt_1_1Dbo_1_1sql__value__traits.html > 2) How can I save this uploaded file to a database? > (I'm thinking something like:) > > wFileResource = new WFileResource(uploaded_.contentType(), > uploaded_.spoolFileName(), this); > picture = wFileResource; You need to open the uploaded_.spoolFileName() using an std::ifstream and copy its data into a std::vector<unsigned char>. Regards, koen ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
