Following is a post which I hope will clarify what I have been doing up until now, along with some questions regarding the correct way to do this.Well, this is what I dont understand :)The file name on the local server can be accessed via the $Request->FileUpload interface:
if I do "$newFile = $Request->Form('filename')";
"print $newFile";
I get back a filename eg, "test.doc".
The next thing I do is $Session->{uploaded_files} = $newFile;
However... if I do "use Data::Dumper; print Dumper $newFile", I get back...
$VAR1 = bless( \*{'Fh::fh00001test.doc'}, 'Fh' );
http://www.apache-asp.org/objects.html#%24Request-%3EFi6799fcec
The data in $Request->Form will not give you a good filename.
Until now, I have always handled file uploads in the following way :
draw in HTML "<input type="file" name="filename">".
Then the form posts in on itself, and I use
my $newFile = $Request->Form('filename');
$newFile is then passed to a module which will basically do the following (along with a lot more):
while ($rets=read($newFile,$line,1024)) { # Read in BINARY
my @lin = $line;
my $status = append_file($destination_path, $file,\@lin);
if (!$status) {
return(0,"error storing file on server ($!)");
}
@lin = ();
}
This has always worked for me.
Now however, I need to not only upload the file to the server, but I need to store the filename in a database (among doing other things with the filename).
So should I be doing :
my $newFile = $Request->{FileUpload}{filename};
$newFile = $newFile->{BrowserFile};
?
If not, what should I be doing.
What should I call to get handle, and what should I call to get the actual filename ?
I am sooo confused !
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]