Suggestions for File Saving?

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

Suggestions for File Saving?

Postby Kahuna » Fri Apr 06, 2012 6:12 pm

Hi Folks - hoping someone will have a few moments to suggest a direction I can follow, for the following requirement.

I need to save files, BMP/GIF/JPG and PDF's all in a db table. I have the column as an image type in SQL Server and of course I can add a graphic to that field using the standard Web Client to insert a file when displaying it as a media field type. But that only allows for a graphic not a pdf.

I'd be quite happy to add a link in my display table (maybe a hyper-link or something) and show the file in its native app (acrobat for example), but I'm not sure how to save that file in the column and how to then re-show it with the link.

For logistical reasons I don't want to save the files to the server and there will not be so many it will cause a db size issue.

Cheers
(Servoy Version: 6.0.7 Win XP / 7 - SQL Server 2008 R2)
Ian Cordingley (Kahuna)
Kahuna
 
Posts: 1235
Joined: Thu Oct 26, 2006 1:39 am
Location: 1/2 NE UK 1/2 Olvera Spain

Re: Suggestions for File Saving?

Postby ngervasi » Fri Apr 06, 2012 6:42 pm

If you create that column via Servoy as a "Media" column it will take care of mapping it to the correct SQL Server column type (in Postgres it's bytea) and you will be able to store anything binary in that.
For adding a link to your display table use the file plugin to save the file to the client machine or search the forum for "blobloader".
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy

Re: Suggestions for File Saving?

Postby Kahuna » Fri Apr 06, 2012 6:57 pm

ngervasi wrote:If you create that column via Servoy as a "Media" column it will take care of mapping it to the correct SQL Server column type (in Postgres it's bytea) and you will be able to store anything binary in that.
For adding a link to your display table use the file plugin to save the file to the client machine or search the forum for "blobloader".


Thanks Nicola - I see the file plugin tools and we use them to store files on the server, but I'm not sure how to save an image or a pdf to a table column - guess I'm missing the obvious?
(Servoy Version: 6.0.7 Win XP / 7 - SQL Server 2008 R2)
Ian Cordingley (Kahuna)
Kahuna
 
Posts: 1235
Joined: Thu Oct 26, 2006 1:39 am
Location: 1/2 NE UK 1/2 Olvera Spain

Re: Suggestions for File Saving?

Postby ngervasi » Fri Apr 06, 2012 7:02 pm

Kahuna wrote:
ngervasi wrote:If you create that column via Servoy as a "Media" column it will take care of mapping it to the correct SQL Server column type (in Postgres it's bytea) and you will be able to store anything binary in that.
For adding a link to your display table use the file plugin to save the file to the client machine or search the forum for "blobloader".


Thanks Nicola - I see the file plugin tools and we use them to store files on the server, but I'm not sure how to save an image or a pdf to a table column - guess I'm missing the obvious?


Yes ;)
Read the file (this depends from where you read it) and save it to your column by simply:

Code: Select all
myMediacolumn = myMediaVar/myBytesArray
databaseManagerSaveData()
Nicola Gervasi
sintpro.com
SAN Partner
ngervasi
 
Posts: 1485
Joined: Tue Dec 21, 2004 12:47 pm
Location: Arezzo, Italy


Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests