Have a WebClient app and need to store documents - mostly Word, Excel, PDF - in a table. Admin Users will upload the docs so that visitors can download to save/print etc.
Uploading works fine using the Upload icon in Web Browsers but I can’t find a reliable way to:
a) extract the filename:
plugins.images. provides a range of info geared towards JPGs but not the name?
A post last October suggested that getting filenames would become automatic :
We will implement it this way (so that it also works in webclient) if you have: ‘my_image’ blob field where you build that media field on then you also specify ‘my_image_mimetype’ and ‘my_image_filename’ and we will also update those fields when the my_image field is filled.
b) provide users with a clickable link to open the docs:
understand that it should be possible to create a calculated HTML field with the BLOB details so that Users can just click to open the file but have tried multiple combinations of calcs using snippets from previous posts but no success. Clicking on the Image field ‘Save’ icon works sometimes but not consistently with .PDF/.DOC documents - and doesn’t really fit with the GUI.
Hi, I am having the same problem.
a) To get the path of the file selected.
2) Instead of storing it to db I need to store it to a particular directory.
On smart client I am using showFileOpenDialog().
and it is working fine.
In case of web client using media data type I can upload a file(.doc or .ppt)
to the db table. But I need to store it to a particular directory.
Hi Graham,
I hope there will be better support for uploading in the near future but for now there’s no easy way.
grahamg:
b) provide users with a clickable link to open the docs:
This is the right syntax to use the blobloader (from an old post of Paul Bakker):
var URL = 'media:///servoy_blobloader?servername=' + currentcontroller.getServerName() + '&tablename=XXXXX&dataprovider=YYYYY&rowid1=' + ZZZZZ+'&mimetype='+AAAAA+'&filename='+BBBBBB
return '<html><body><a target="_blank" href="'+URL+'">test</a></body></html>';
Where:
- XXXXX is the name of the table your file is stored in
- YYYYYY is the columnname of the column where the file is stored
- ZZZZZ is value of the PK field of the row (In case of a PK buildup out of multiple columns, add &rowid2=value ... &rowidXX=value)
- AAAAA is the mimetype of the file
- BBBBB is the name of the file
Thanks for this. Yes I had been using Pauls very helpful earlier post as basis for my trials however had been getting mixed results.
Word docs are always recognised and opened fine. PDF docs sometimes have the file name corrupted and a document with name ‘Specification.pdf’ results in error message like ‘Specification[1].pdf’ cannot be opened. A couple of Excel spreadsheets showed document Mimetype as ‘Word’!!
I’ve probably got a stray space or missing ‘"’ somewhere in the code but will have another go later.