CGI upload problem on IE

2005-01-29 Thread Yw Chan ( Cai Lun e-Business )
Hi,
I'm trying to write a CGI using perl for uploading multiple files, 
here's my part of codes.

==
   my @fax_files = map(symlink($query-tmpFileName($_), /tmp/fax_$_)
   ? /tmp/fax_$_ : (),
   $query-upload(files));
===
I guess on IE, the browser returns back the whole path including 
C:\Documents and Settingetc. However, the space breaks the list of 
filename that's in /tmp/fax_$_

It is working in Firefox and what I see in Firefox is the path 
C:\Documents and Setting... etc has been removed and only the filename 
back to the server. That's my guess.

See if any experienced guy can tell me how I should handle this in IE 
actually.

Thanks a lot, CHAN
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.1 - Release Date: 27/1/2005
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI upload problem on IE

2005-01-29 Thread Alfred Vahau
Hi,
My workaround in Windows to the space in file names (which the *nix 
don't allow) are the following:
(1) Use an underscore instead of space in file names
(2) Surround the file name with quotes if spaces are retained
(3) Use the hex representation of space (%20) in file names

HTH,
alfred,
Yw Chan ( Cai Lun e-Business ) wrote:
Hi,
I'm trying to write a CGI using perl for uploading multiple files, 
here's my part of codes.

==
   my @fax_files = map(symlink($query-tmpFileName($_), /tmp/fax_$_)
   ? /tmp/fax_$_ : (),
   $query-upload(files));
===
I guess on IE, the browser returns back the whole path including 
C:\Documents and Settingetc. However, the space breaks the list of 
filename that's in /tmp/fax_$_

It is working in Firefox and what I see in Firefox is the path 
C:\Documents and Setting... etc has been removed and only the filename 
back to the server. That's my guess.

See if any experienced guy can tell me how I should handle this in IE 
actually.

Thanks a lot, CHAN

--
Perl - 
... making the easy jobs easy,
without making the hard jobs impossible.
'The Camel', 3ed

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI upload problem on IE

2005-01-29 Thread Bob Showalter
Alfred Vahau wrote:
Hi,
My workaround in Windows to the space in file names (which the *nix
don't allow) are the following:
Huh? Unix allows spaces in file names.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI upload problem on IE

2005-01-29 Thread Alfred Vahau
 Unix allows spaces in file names.
Agree. But for a Unix-centric person like me operating in an otherwise 
all Windows environment, I've found that the use
of space in Windows filenames is more liberal than in Unix in so far as 
the use of commands go. So for anyone starting with
Windows and heading in the Unix direction, the advice would be to avoid 
the use of space in the file names. After all the web is deeply rooted 
in the Unix culture.

alfred,
--
Perl - 
... making the easy jobs easy,
without making the hard jobs impossible.
'The Camel', 3ed

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Problem assigning with File::Find

2005-01-29 Thread Ron Goral
Greetings all -

I am having some problems understanding an issue of assignment within a
closure (I think its a closure).  My code is below.  I've added the line
numbers for reference. Note that this is an excerpt from a module.
'$hr_self' is a blessed hash ref to the module. 'FindDGLibDir' is called
with: $hr_self-FindDGLibDir();

1  sub FindDGLibDir
2  {
3  # Modules to use
4  use File::Find;
5  use Cwd;
6
7  my ($hr_self) = @_;
8
9  my $process_file = sub
10  {
11  # Exit the process if we have the directory already
12  return if $hr_self-{dglib_dir} ne '';
13  # This is a directory and the name ends in 'dglib'
14  if (-d  m/dglib$/){$hr_self-{dglib_dir} = $File::Find::name;}
15  };
16
17  # Get the root to cgi-bin
18  cwd =~ m'(.*\/cgi-bin)';
19  # Search cgi-bin looking for dglib and return any errors
20  find(\$process_file, $1);
21  return 0 if $hr_self-{dglib_dir} eq '';
22
23  return 1;
24  }   # end FindDGLibDir

'$hr_self-{dglib_dir}' at line 14 cannot be assigned to.  If I substitute
'my $string' there, it works fine. '$hr_self-{dglib_dir}' is obviously a
valid var since it is used successfully in line 12. Can anyone tell me why
there is trouble in line 14?

Thanks
Ron



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: CGI upload problem on IE

2005-01-29 Thread Yw Chan ( Cai Lun e-Business )
However, the situation is that ehe spaces not from my filename but from 
the Windows XP default of C:\Documents and Settings\Default user\. 
etc. I guess in an overwhelming web-based environment using Windows at 
the browser side, most people would come across this issue. I'm 
wondering if there is something else would make IE returns the path just 
liked Firefox that has no problem at all.


Bob Showalter wrote:
Alfred Vahau wrote:
Hi,
My workaround in Windows to the space in file names (which the *nix
don't allow) are the following:

Huh? Unix allows spaces in file names.

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.1 - Release Date: 27/1/2005
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI upload problem on IE

2005-01-29 Thread Bob Showalter
Yw Chan ( Cai Lun e-Business ) wrote:
However, the situation is that ehe spaces not from my filename but
from the Windows XP default of C:\Documents and Settings\Default
user\. etc. I guess in an overwhelming web-based environment
using Windows at the browser side, most people would come across this
issue. I'm wondering if there is something else would make IE returns
the path just liked Firefox that has no problem at all.
You should never make any assumptions about the filename the client might 
send. The backslashes are legal filename chars in Unix, but if you don't 
want them, just strip them off.

  $filename =~ s/.*[\\\/]//;
You should check whatever's left against the set of characters you want to 
allow. 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: CGI upload problem on IE

2005-01-29 Thread Bob Showalter
Yw Chan ( Cai Lun e-Business ) wrote:
However, the situation is that ehe spaces not from my filename but
from the Windows XP default of C:\Documents and Settings\Default
user\. etc. I guess in an overwhelming web-based environment
using Windows at the browser side, most people would come across this
issue. I'm wondering if there is something else would make IE returns
the path just liked Firefox that has no problem at all.
You should never make any assumptions about the filename the client might 
send. The backslashes are legal filename chars in Unix, but if you don't 
want them, just strip them off.

  $filename =~ s/.*[\\\/]//;
You should check whatever's left against the set of characters you want to 
allow. 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response