Since it looks like there will be no support for Quicktime soon and we know Servoy already can work with BLOBs how about letting us store any type of file not just images. This way I could put a Photoshop, Quark, Quicktime or any other type of file in the database. It would need to store the file name and file extension so they can easily be saved back by users.
Maybe someone is already doing this using what is already available if so let us know how.
Jan Blok:
The imagemedia field type is bit misleading, it actually stores ANY file you want!
It only displays known image types.
I noticed that it will work with any file right now but it seems not to store the name or extension so when you go to save it back you have to know what it was (at least on the Mac). Is there anyway around this currently?
It would be nice if it showed a file icon if there was a file already stored there too.
the easy way of doing this is store the filename in other field
filename = application.showFileOpenDialog();
if (filename)//for cancel
{
mediaField = application.readFile(filename);
}
That works well, gets the whole path name not just the file name though, will have to write something to parse that out. How about saving the file what is an easy way to pull the name and put it in the save dialog?
Ah, yes it is possible that normalizedFileName does not contain a ‘/’ at all, so do the following:
var normalizedFileName = “”;
if (fileName)
{
normalizedFileName = utils.stringReplace(filename,‘\’,‘/’)//make windows path like unix path
vat idx = normalizedFileName.lastIndexOf(“/”,0);
if (idx != -1) normalizedFileName = normalizedFileName.substring(idx );
}
application.openSaveDialog(normalizedFileName);
Hi Jan,
did you test this in Servoy?
it is not working, first of all the function openSaveDialog is now: showFileSaveDialog
and vat = var
If I do the following:
var normalizedFileName = "";
if (bestandspad)
{
normalizedFileName = utils.stringReplace(bestandspad,'\\','/')//make windows path like unix path
var idx = normalizedFileName.lastIndexOf("/",0);
if (idx != -1) normalizedFileName = normalizedFileName.substring(idx );
}
application.showFileSaveDialog(normalizedFileName);
I still get the complete pad + filename in the save-dialog
hmm lastIndexOf searches back if you provide a second argument…
try:
var normalizedFileName = "";
if (bestandspad)
{
normalizedFileName = utils.stringReplace(bestandspad,'\\','/')//make windows path like unix path
var idx = normalizedFileName.lastIndexOf("/");
if (idx != -1) normalizedFileName = normalizedFileName.substring(idx );
}
application.showFileSaveDialog(normalizedFileName);