Re: WOFileUpload bindings [SOLVED]
Re: WOFileUpload bindings [SOLVED]
- Subject: Re: WOFileUpload bindings [SOLVED]
- From: Chuck Hill <email@hidden>
- Date: Wed, 15 Dec 2004 16:28:14 -0800
NSPathUtilities.lastPathComponent
At 03:26 PM 15/12/2004 -0800, David Holt wrote:
>>>>
I tried using NSPathUtilities to get the last component, but it was still
returning the absolute path on the Window's user's file system. In the end
I went with a solution that had been posted back in May 2003. Instead of
binding the filepath directly to the EO filename attribute, I now pass it
to a temporary variable that is manipulated in java before being passed to
the database. Here is the code I am using. Thanks Chuck, your suggestion
eventually led me to this solution in a previous thread:
// When the WOFileUpload filepath key is bound to a value from WindowsIE
it brings the complete
// absolute filepath to the user's file. This is not useful when it comes
to storing
// the filename in the database or for downloading the file later. This
code parses out the filename
// from a Windows IE generated filepath.
// the aFileName variable is bound to the filePath variable on the
WOFileUpload component
// tempFileName is the parsed filename which is then passed to the EO as
the real FileName
// before the changes to the Editing Context are committed to the database.
if ( (aFileName != null) && (aFileName.length() > 0) ) {
int length1 = aFileName.length();
String tempFileName = "";
for(int i=0; i< length1; i++) {
if(aFileName.substring(i, i+1).equals("\\")) {
tempFileName="";
} else {
tempFileName = tempFileName + aFileName.substring(i,i+1);
}
}
anUpload.setFileName(tempFileName);
NSLog.out.appendln( "FileName: "+tempFileName );
} else {
NSLog.out.appendln( "No File Uploaded" );
}
--
hatred bounces.
e. e. cummings
from Sunbeams: http://www.thesunmagazine.org
On 12 Dec 2004, at 2:35 PM, Chuck Hill wrote:
The file name / path sent up with the file is browser dependant. It is
your job to deal with as you need. See NSPathUtilities for the easiest way
to get just the file name.
Chuck
At 02:14 PM 12/12/2004 -0800, David Holt wrote:
Hello all,
I am getting inconsistent behaviour from IE for Windows (inconsistent
when compared to Firefox or Safari, anyway) when I use this WOExtension
in WO 5.2.3.
I am uploading documents directly to a database so I am binding "data"
to the EO document.attachment and the "filePath" to EO
document.file_path. When using Safari or Mozilla the file stores in the
BLOB and just the filename ends up in the file_path field. Using IE the
data ends up in the BLOB, but the filename is set to the entire path to
the user's document on their file system. When you try and download it,
it gives the usual WO reference of a bunch of numbers. If you change
the filename in the Save As dialog, the data is fine and results in the
document being saved to the user's computer. The behaviour is
inconsistent only for the filePath binding. If you download a file that
has been uploaded from a Safari or Mozilla browser the filename is
displayed correctly in the Save as... dialog.
Should I be using different bindings in the WOFileUpload? Or is there
something I am overlooking? Is there anyone using this extension with
Windows to upload documents to a database?
thanks,
David
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
e.net
This email sent to email@hidden
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
<<<<
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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