Re: Newbie : Upload file to database Method
Re: Newbie : Upload file to database Method
- Subject: Re: Newbie : Upload file to database Method
- From: John Larson <email@hidden>
- Date: Wed, 27 Sep 2006 21:28:34 -0500
Gilles,
I think I get what you're asking . . .
WOFileUpload is responsible for getting the file from the client
browser into a NSData field in your application. (In this case it
looks like it is called aFileMp3.) The file on the client browser
becomes a data stream upon transmission from the client and is stored
in the db (via eo) as a data blob. Depending on the db
implementation, the blob may be a its own file, but the storage idiom
is not really that of a file - it's an attribute of a record.
Consequently, the point of the file's origination doesn't matter. As
long as the browser can bring up the application in its window, it
will be able to send the data (file).
John
On Sep 27, 2006, at 8:20 PM, Gilles MATHURIN wrote:
Hello list
i look at the Developper example application who demonstrates the
creation and use of WOFileUpload elements. It says that this
element allows you to transport files from client machines to your
application server. My question is :
Does that mean either "transport" to the database for storing ? Or
only transport to the application for logic treatment ?
I don't know if i am clear, so let me reformulate : Are these
examples adapted in the case you want to upload file to your
database ?
I write a WOwebapp to administrate a database, when i test it on my
dev machine and on my local network, it works great, but will it
work on the final deployment configuration, when the hosted server
will be far away ?
Here is an example of code used in it to upload images or mp3.file
to the database :
===============
public WOComponent recordNewTitre()
{
EOEditingContext ec = album.editingContext();
extraitForm.setExtraitMp3(aFileMp3);
extraitForm.setFileName(aFileNameMp3);
extraitForm.setMimeType(aMimeSoundType);
album.addObjectToBothSidesOfRelationshipWithKey(titreForm,"titres");
titreForm.addObjectToBothSidesOfRelationshipWithKey
(extraitForm,"extraitTitre");
ec.saveChanges();
setTitreList(album.titres().mutableClone());
setBoolTableauList(true);
return null;
}
public NSData aFileMp3()
{
return aFileMp3;
}
public void setAFileMp3(NSData newAFileMp3)
{
aFileMp3 = newAFileMp3;
}
public String aFileNameMp3()
{
return aFileNameMp3;
}
public void setAFileNameMp3(String newAFileNameMp3)
{
aFileNameMp3 = newAFileNameMp3;
}
public String aMimeSoundType()
{
return aMimeSoundType;
}
public void setAMimeSoundType(String newAMimeSoundType)
{
aMimeSoundType = newAMimeSoundType;
}
====================
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden