Project

General

Profile

WFileUpload persistence

Added by Maro RAB over 9 years ago

Hello again community!!!

Like the title suggests, I need some pointers on how to store and retrieve an uploaded file, even if for some reason the .exe server application stops running. I am highlighting that case because when I used the WServer's method addResource to make the WFileResource static, its url couldn't find the file after a restart of the application.

Please reply fast and thank very much for any contributions. If you could give an example with code it would be musch appreciated.


Replies (2)

RE: WFileUpload persistence - Added by Wim Dumon over 9 years ago

See the documentation of WFileUpload::spoolFileName() and WFileUpload::stealSpooledFile(). You should copy or move or steal the spooled file. The spool file is considered a temporary file by Wt, which is cleaned up on deletion of the WFileUpload widget, unless you steal the file (and then you are responsible for cleaning up the file).

Wim.

RE: WFileUpload persistence - Added by Maro RAB over 9 years ago

Thanks a lot Wim!

I am intending to use it to store images so I would like to know how do you specify where to store them and also how to get/create an URL for to stored images so that I can display them in a WImage. Like, can I for example use standard fstreams to save them in the .exe's directory? If so how do access them for the use I outlined above??

Thanks very musch again for the help and a great library! I'm learning loads!!

    (1-2/2)