Line 62 (in the constructor) is your problem:
Wt::WFileUpload *upload = new Wt::WFileUpload(mainContainer);
On line 71 (in the populate() method) you refer to upload:
string spoolfile = upload->spoolFileName();
Note that these two variables, both called 'upload', are not the same.
In the constructor, the local variable 'upload' hides the variable
that lives in the class scope; on line 71, you use the variable that
lives in the class scope (= the class member variable).
Fix:
Remove "Wt::WFileUpload *" from line 62.
valgrind would have shown you clearly that you're accessing
uninitialized memory on line 62.
Side note: I strongy recommend you to always use proper indentation in
your code, you will spot bugs much faster. Compare this:
class WtWidget: public WContainerWidget {
private:
backend::Postgres connection_;
Session session_;
WFileUpload *upload;
public:
WtWidget(WContainerWidget *parent=0);
~WtWidget(){}
void msg(string str);
void populate();
void listAB();
};
WtWidget::WtWidget(WContainerWidget *parent)
:WContainerWidget(parent),
connection_("host=127.0.0.1 user=pinder2 password=pinder2 port=5432
dbname=test0") {
//msg("<b>database Relationship</b>");
connection_.setProperty("show-queries", "true");
session_.setConnection(connection_);
session_.mapClass<A>("a");
try { Transaction tt(session_);
session_.createTables();
to this:
class WtWidget: public WContainerWidget
{
private:
backend::Postgres connection_;
Session session_;
WFileUpload *upload;
public:
WtWidget(WContainerWidget *parent=0);
~WtWidget(){}
void msg(string str);
void populate();
void listAB();
};
WtWidget::WtWidget(WContainerWidget *parent)
: WContainerWidget(parent),
connection_("host=127.0.0.1 user=pinder2 password=pinder2 port=5432
dbname=test0")
{
//msg("<b>database Relationship</b>");
connection_.setProperty("show-queries", "true");
session_.setConnection(connection_);
session_.mapClass<A>("a");
try {
Transaction tt(session_);
session_.createTables();
...
Wim.
2011/9/16 PARVINDER RAJPUT <[email protected]>:
> On Fri, Sep 16, 2011 at 11:28 AM, PARVINDER RAJPUT <[email protected]>
> wrote:
>> My output shown on browser. But it does not connect with database. How
>> to connect the file upload application with database.
> means file stored in database
>> my source code is in below the link
>> http://paste.ubuntu.com/690523/
>> please help me. i am unable to connect with database
>
>
>
> --
> Parvinder Rajput
> website:- www.parvinder.co.in
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> http://p.sf.net/sfu/rim-devcon-copy2
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest