You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Richard Curtis <ri...@crosswired.co.uk> on 2003/02/10 22:59:14 UTC
Another stupid question...
OK, I am sorry for posting stupid questions, but I have been at this all
night and got no-where.
Right, I have a page which allows upload of files.
The user uploads several files, and I cache the filename of the file
they uploaded using the session.
So, the session contains a list of filenames.
I am now passing this array of filenames to a backend module.
The files are already uploaded to a tmp directory by now.
In the backend module, I move the files from the temporary directory, to
the proper storage location.
When I call :
move_file("$srcDir$file","$dstDir$file"),
I get the following error :
Utilities:move_file : cannot find file
/home/myapp/data/tmp/test_user/Fh=GLOB(0x86983bc)
I know the reason behind the error - it is because the filename I stored
in the session is really a handle to the uploaded file.
The question is, how can I simply get back the filename rather than the
filehandle....
I am stumped on this one.
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Tim Pushor <ti...@crossthread.com>.
Richard,
I'm sorry, I too am stumped. Perhaps Josh can help shed some light..
Tim
Richard Curtis wrote:
> Thanks for your post. I have gone over all of my code, and changed it
> to exactly how you do it.
> I have set "PerlSetVar FileUploadTemp 1" and restarted apache.
> All pages which upload a file use:
>
> my $upload_file = $Request->{FileUpload}{filename};
> # "filename" is the name of the form item.
> my $newFileLocation = $upload_file->{TempFile};
> my $newFileName = $upload_file->{BrowserFile};
>
> This works fine, although I still have a problem.
>
> I build an array out of the filenames (taken from $newFileName) which
> is used to add entries for the files into a database.
> The problem is, when I use code such as :
>
> # this code is using perls DBI interface...
> $add_statement = $dbh->prepare("insert into submission_files
> values(default,'$last_ID',(?),(?),(?))");
> foreach my $file (@$files) {
> # execute
> $add_statement->execute($file,$fileDescriptions[$i],$signature);
> $i++;
> }
>
> The database dies with the following error:
>
> Can't bind a reference (Fh=GLOB(0x877e28c)) at
> /home/application/secure/perl/APP/Submissions/AddSubmission.pm line
> 168. <--> , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1489
>
> This shows that the filename returned by my "$newFileName =
> $upload_file->{BrowserFile};" is still actually a file glob.
>
> I can solve the problem by quoting $file in the
> $add_statement->execute() line, but I am sure this shouldnt be neccesary.
>
> It appears that the $upload_file->{BrowserFile}; is malfunctioning,
> or, (and more probably), that I am totally misunderstanding this.
>
> Richard
>
>> Richard,
>>
>> I'm not quite sure why its doing what its doing. I have only done one
>> real project with Apache::ASP that handles file uploads, but again,
>> how I do it is:
>>
>> 1) Make sure you do a PerlSetVar FileUploadTemp 1 in httpd.conf -
>> this will ensure that Apache::ASP actually downloads the file for you
>> and puts it into a temporary file. Otherwise you just get a
>> filehandle to the file and have to read it and spool it to the file
>> yourself (thats how I understood it anyway).
>>
>> 2) Get the hash with a my $upload_file =
>> $Request->{FileUpload}{upload_form_element};
>>
>> 3) Get the name of the (temporary) file that Apache::ASP downloaded
>> the file into: $filename=$upload_file->{TempFile};
>>
>> You can then move the file wherever you want. This method works great
>> for me.
>>
>> Tim
>
> <snip>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
> Richard Curtis wrote:
>
>>
>> This works fine, although I still have a problem.
>>
>> I build an array out of the filenames (taken from $newFileName) which
>> is used to add entries for the files into a database.
>> The problem is, when I use code such as :
>>
>> # this code is using perls DBI interface...
>> $add_statement = $dbh->prepare("insert into submission_files
>> values(default,'$last_ID',(?),(?),(?))");
>> foreach my $file (@$files) {
>> # execute
>> $add_statement->execute($file,$fileDescriptions[$i],$signature);
>> $i++;
>> }
>>
>> The database dies with the following error:
>>
>> Can't bind a reference (Fh=GLOB(0x877e28c)) at
>> /home/application/secure/perl/APP/Submissions/AddSubmission.pm line
>> 168. <--> , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1489
>>
>
> Internally, its actually the same, but the intent is for
> BrowserFile to reflect just the filename, not be the file handle
> as well.
>
> The fix for this internally is to stringify BrowserFile too,
> as you suggest, and I will apply this fix for the 2.53 release.
> Let me know if you would like an early copy of this.
>
Thanks for taking the time to read my posts and confirm the issues.
I have put a fix into my code to work around this so I dont think I will
benefit from a pre-release copy.
Thanks for all the hard work.
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Josh Chamas <jo...@chamas.com>.
Richard Curtis wrote:
>
> This works fine, although I still have a problem.
>
> I build an array out of the filenames (taken from $newFileName) which is
> used to add entries for the files into a database.
> The problem is, when I use code such as :
>
> # this code is using perls DBI interface...
> $add_statement = $dbh->prepare("insert into submission_files
> values(default,'$last_ID',(?),(?),(?))");
> foreach my $file (@$files) {
> # execute
> $add_statement->execute($file,$fileDescriptions[$i],$signature);
> $i++;
> }
>
> The database dies with the following error:
>
> Can't bind a reference (Fh=GLOB(0x877e28c)) at
> /home/application/secure/perl/APP/Submissions/AddSubmission.pm line 168.
> <--> , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1489
>
Internally, its actually the same, but the intent is for
BrowserFile to reflect just the filename, not be the file handle
as well.
The fix for this internally is to stringify BrowserFile too,
as you suggest, and I will apply this fix for the 2.53 release.
Let me know if you would like an early copy of this.
Regards,
Josh
________________________________________________________________
Josh Chamas, Founder phone:925-552-0128
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
Thanks for your post. I have gone over all of my code, and changed it
to exactly how you do it.
I have set "PerlSetVar FileUploadTemp 1" and restarted apache.
All pages which upload a file use:
my $upload_file = $Request->{FileUpload}{filename};
# "filename" is the name of the form item.
my $newFileLocation = $upload_file->{TempFile};
my $newFileName = $upload_file->{BrowserFile};
This works fine, although I still have a problem.
I build an array out of the filenames (taken from $newFileName) which is
used to add entries for the files into a database.
The problem is, when I use code such as :
# this code is using perls DBI interface...
$add_statement = $dbh->prepare("insert into submission_files
values(default,'$last_ID',(?),(?),(?))");
foreach my $file (@$files) {
# execute
$add_statement->execute($file,$fileDescriptions[$i],$signature);
$i++;
}
The database dies with the following error:
Can't bind a reference (Fh=GLOB(0x877e28c)) at
/home/application/secure/perl/APP/Submissions/AddSubmission.pm line 168.
<--> , /usr/local/lib/perl5/site_perl/5.6.1/Apache/ASP.pm line 1489
This shows that the filename returned by my "$newFileName =
$upload_file->{BrowserFile};" is still actually a file glob.
I can solve the problem by quoting $file in the
$add_statement->execute() line, but I am sure this shouldnt be neccesary.
It appears that the $upload_file->{BrowserFile}; is malfunctioning, or,
(and more probably), that I am totally misunderstanding this.
Richard
> Richard,
>
> I'm not quite sure why its doing what its doing. I have only done one
> real project with Apache::ASP that handles file uploads, but again, how
> I do it is:
>
> 1) Make sure you do a PerlSetVar FileUploadTemp 1 in httpd.conf - this
> will ensure that Apache::ASP actually downloads the file for you and
> puts it into a temporary file. Otherwise you just get a filehandle to
> the file and have to read it and spool it to the file yourself (thats
> how I understood it anyway).
>
> 2) Get the hash with a my $upload_file =
> $Request->{FileUpload}{upload_form_element};
>
> 3) Get the name of the (temporary) file that Apache::ASP downloaded the
> file into: $filename=$upload_file->{TempFile};
>
> You can then move the file wherever you want. This method works great
> for me.
>
> Tim
<snip>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Tim Pushor <ti...@crossthread.com>.
Richard,
I'm not quite sure why its doing what its doing. I have only done one
real project with Apache::ASP that handles file uploads, but again, how
I do it is:
1) Make sure you do a PerlSetVar FileUploadTemp 1 in httpd.conf - this
will ensure that Apache::ASP actually downloads the file for you and
puts it into a temporary file. Otherwise you just get a filehandle to
the file and have to read it and spool it to the file yourself (thats
how I understood it anyway).
2) Get the hash with a my $upload_file =
$Request->{FileUpload}{upload_form_element};
3) Get the name of the (temporary) file that Apache::ASP downloaded the
file into: $filename=$upload_file->{TempFile};
You can then move the file wherever you want. This method works great
for me.
Tim
Richard Curtis wrote:
<snip>
>
> I have one further query. If I do the following.. (where "filename"
> is the name of the file upload box on the html page) :
>
> my $newFileHandle = $Request->Form('filename');
> my $newFileName = $Request->FileUpload('filename','BrowserFile');
>
> Is that the correct syntax ?
> I mean it appear to work, but I still notice something slightly strange.
> If I print them both, they both show the same :
>
> my $newFileHandle = $Request->Form('filename');
> print "file handle: $newFileHandle <br>";
> my $newFileName = $Request->FileUpload('filename','BrowserFile');
> print "name: $newFileName <br>";
>
> ... this gives :
> file handle: points.doc
> name: points.doc
>
> If I print to Data::Dumper as follows :
>
> print Dumper $newFileHandle . "<br>";
> print Dumper $newFileName . "<br>";
>
> I get the following output....
>
> file handle: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
> name: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
>
> So, what is the difference.
> When I ask for "browserFile" from the FileUpload request object, why
> is it still a file handle ?
>
> Maybe I am just being incredibly stupid, but I dont see any difference
> to doing it this way, as to the way I was initially doing it.
>
> Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
>> 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.
>>
>> 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).
>
>
> When you say filename, I will assume you mean the file name client side
> being uploaded...
>
>> So should I be doing :
>> my $newFile = $Request->{FileUpload}{filename};
>> $newFile = $newFile->{BrowserFile};
>>
>
> Right BrowserFile will give you the name of the file as it was uploaded.
>
>> ?
>> If not, what should I be doing.
>> What should I call to get handle, and what should I call to get the
>> actual filename ?
>>
>
> Well, what you have been doing works fine for getting the file handle,
> but you can also get it from;
>
> $Request->FileUpload('upload_file', 'FileHandle');
>
>>
>> I am sooo confused !
>
>
> Originally, the file upload interface was only available through
> doing it as you do with
>
> my $fh = $Request->Form('upload_file')
>
> but as users needed more of the file upload info, I created the
> FileUpload collection to store more of the data. Originally
> MS ASP did not have any native file upload support, so I had not
> API to emulate here, and had to make it up as we went.
>
I have one further query. If I do the following.. (where "filename" is
the name of the file upload box on the html page) :
my $newFileHandle = $Request->Form('filename');
my $newFileName = $Request->FileUpload('filename','BrowserFile');
Is that the correct syntax ?
I mean it appear to work, but I still notice something slightly strange.
If I print them both, they both show the same :
my $newFileHandle = $Request->Form('filename');
print "file handle: $newFileHandle <br>";
my $newFileName = $Request->FileUpload('filename','BrowserFile');
print "name: $newFileName <br>";
... this gives :
file handle: points.doc
name: points.doc
If I print to Data::Dumper as follows :
print Dumper $newFileHandle . "<br>";
print Dumper $newFileName . "<br>";
I get the following output....
file handle: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
name: $VAR1 = bless( \*{'Fh::fh00003points.doc'}, 'Fh' );
So, what is the difference.
When I ask for "browserFile" from the FileUpload request object, why is
it still a file handle ?
Maybe I am just being incredibly stupid, but I dont see any difference
to doing it this way, as to the way I was initially doing it.
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Josh Chamas <jo...@chamas.com>.
Richard Curtis wrote:
>
> 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.
>
> 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).
When you say filename, I will assume you mean the file name client side
being uploaded...
> So should I be doing :
> my $newFile = $Request->{FileUpload}{filename};
> $newFile = $newFile->{BrowserFile};
>
Right BrowserFile will give you the name of the file as it was uploaded.
> ?
> If not, what should I be doing.
> What should I call to get handle, and what should I call to get the
> actual filename ?
>
Well, what you have been doing works fine for getting the file handle,
but you can also get it from;
$Request->FileUpload('upload_file', 'FileHandle');
>
> I am sooo confused !
Originally, the file upload interface was only available through
doing it as you do with
my $fh = $Request->Form('upload_file')
but as users needed more of the file upload info, I created the
FileUpload collection to store more of the data. Originally
MS ASP did not have any native file upload support, so I had not
API to emulate here, and had to make it up as we went.
Regards,
Josh
________________________________________________________________
Josh Chamas, Founder phone:925-552-0128
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
>> Well, this is what I dont understand :)
>> 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' );
>>
>
> The file name on the local server can be accessed via the
> $Request->FileUpload interface:
>
> http://www.apache-asp.org/objects.html#%24Request-%3EFi6799fcec
>
> The data in $Request->Form will not give you a good filename.
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.
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: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
>> Well, this is what I dont understand :)
>> 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' );
>>
>
> The file name on the local server can be accessed via the
> $Request->FileUpload interface:
>
> http://www.apache-asp.org/objects.html#%24Request-%3EFi6799fcec
>
> The data in $Request->Form will not give you a good filename.
OK, then I have had a *major* misunderstanding of how to do file uploads
in Apache::ASP.
It is late here so I am going to call it a night, but tomorrow, I will
formulate a proper post with some questions.
I appreciate all of the help I have received so far.
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Josh Chamas <jo...@chamas.com>.
Richard Curtis wrote:
> Well, this is what I dont understand :)
> 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' );
>
The file name on the local server can be accessed via the $Request->FileUpload interface:
http://www.apache-asp.org/objects.html#%24Request-%3EFi6799fcec
The data in $Request->Form will not give you a good filename.
Regards,
Josh
________________________________________________________________
Josh Chamas, Founder phone:925-552-0128
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
Well, this is what I dont understand :)
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' );
I am lost.
Any thoughts ?
Richard
> I think I understand.
>
> does $newfile contain the filename before being put into the $Session? I
> guess I'm just not sure whats failing.. Is it the
> $Request->Form('filename') ?
>
> Richard Curtis wrote:
>
>> Errrr....
>> I dont do it like this.
>> I post into the page, then "my $newFile = $Request->Form('filename')"
>> gives me the handle/filename.
>>
>> I upload the file (using a perl function I wrote), then afterwards,
>> set $Session->{new_file} = $newFile;
>>
>> I do all of the upload manually. I have a perl function in a module
>> which reads from $newFile, and puts the data where I want it.
>>
>> Richard
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Richard Curtis <ri...@crosswired.co.uk>.
Errrr....
I dont do it like this.
I post into the page, then "my $newFile = $Request->Form('filename')"
gives me the handle/filename.
I upload the file (using a perl function I wrote), then afterwards, set
$Session->{new_file} = $newFile;
I do all of the upload manually. I have a perl function in a module
which reads from $newFile, and puts the data where I want it.
Richard
> Richard,
>
> How are you determining the filename?
>
> I looked back in a piece of code, and I am doing something like:
>
> my $fileup=$Request->{FileUpload}{upload_file};
> my $browserfile=$fileup->{BrowserFile};
> my $filehandle=$fileup->{FileHandle};
> my $tempfile=$fileup->{TempFile};
>
> I believe that $tempfile holds the name of the file as is sitting on the
> drive after the upload.
>
> I also have:
>
> PerlSetVar FileUploadTemp 1
>
> Set in httpd.conf
>
> Tim
>
> Richard Curtis wrote:
>
>> OK, I am sorry for posting stupid questions, but I have been at this
>> all night and got no-where.
>>
>> Right, I have a page which allows upload of files.
>> The user uploads several files, and I cache the filename of the file
>> they uploaded using the session.
>> So, the session contains a list of filenames.
>>
>> I am now passing this array of filenames to a backend module.
>> The files are already uploaded to a tmp directory by now.
>>
>> In the backend module, I move the files from the temporary directory,
>> to the proper storage location.
>> When I call :
>> move_file("$srcDir$file","$dstDir$file"),
>>
>> I get the following error :
>>
>> Utilities:move_file : cannot find file
>> /home/myapp/data/tmp/test_user/Fh=GLOB(0x86983bc)
>>
>> I know the reason behind the error - it is because the filename I
>> stored in the session is really a handle to the uploaded file.
>>
>> The question is, how can I simply get back the filename rather than
>> the filehandle....
>>
>> I am stumped on this one.
>>
>> Richard
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
>> For additional commands, e-mail: asp-help@perl.apache.org
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: Another stupid question...
Posted by Tim Pushor <ti...@crossthread.com>.
Richard,
How are you determining the filename?
I looked back in a piece of code, and I am doing something like:
my $fileup=$Request->{FileUpload}{upload_file};
my $browserfile=$fileup->{BrowserFile};
my $filehandle=$fileup->{FileHandle};
my $tempfile=$fileup->{TempFile};
I believe that $tempfile holds the name of the file as is sitting on the
drive after the upload.
I also have:
PerlSetVar FileUploadTemp 1
Set in httpd.conf
Tim
Richard Curtis wrote:
> OK, I am sorry for posting stupid questions, but I have been at this
> all night and got no-where.
>
> Right, I have a page which allows upload of files.
> The user uploads several files, and I cache the filename of the file
> they uploaded using the session.
> So, the session contains a list of filenames.
>
> I am now passing this array of filenames to a backend module.
> The files are already uploaded to a tmp directory by now.
>
> In the backend module, I move the files from the temporary directory,
> to the proper storage location.
> When I call :
> move_file("$srcDir$file","$dstDir$file"),
>
> I get the following error :
>
> Utilities:move_file : cannot find file
> /home/myapp/data/tmp/test_user/Fh=GLOB(0x86983bc)
>
> I know the reason behind the error - it is because the filename I
> stored in the session is really a handle to the uploaded file.
>
> The question is, how can I simply get back the filename rather than
> the filehandle....
>
> I am stumped on this one.
>
> Richard
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org