Re: [Cppcms-users] [uploading file] Caught exception [File was not loaded]
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2011-08-07 06:35:49
|
Hello Allan, There are may be several reasons: 1. File was not uploaded by user and you hadn't set non_empty() option so it is validated. In such case you need to check if the file was actually uploaded by calling set() member function of file widget. 2. You hadn't specified enctype="multipart/form-data" in your form HTML part and you also hadn't set non_empty() option. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ >________________________________ >From: Allan SIMON <all...@su...> >To: cpp...@li... >Sent: Sunday, August 7, 2011 2:12 AM >Subject: [Cppcms-users] [uploading file] Caught exception [File was not loaded] > >I'm trying to use the widgets::file to upload images > >but when I try to have access to the uploaded file using .value, this >exception is raised > >2011-08-06 23:04:31 GMT; cppcms, error: Caught exception [File was not >loaded] > >I use the following code > > > forms::my_profile::ChangeAvatar form; > form.load(context()); > > if (form.avatar.validate()) { > > > std::istream& data = form.avatar.value()->data().seekg(0); > > >Thanks in advance. > >Regards, > >Allan > >------------------------------------------------------------------------------ >BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >The must-attend event for mobile developers. Connect with experts. >Get tools for creating Super Apps. See the latest technologies. >Sessions, hands-on labs, demos & much more. Register early & save! >http://p.sf.net/sfu/rim-blackberry-1 >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |