craigrichards
Programmer
I wrote a Perl script that mimics almost all FTP client functions - however...
The upload function works great for text and image file uploads and writes them just fine as long as the text file is plain text or HTML.
If I upload a script, it won't execute (yes, permissions are changed to 755 or 777). If I use my FTP client to download the script and reupload - with no modifications whatsoever - it executes perfectly.
I suspect it's an issue with how my script utility is writing the file. Is there a mode I can switch to? Are there hidden characters generated by the browser form field that need to be stripped? Is there a "header" line (or some other string) that needs to precede the while print loop?
Server: Linux/Apache/Perl5
Browser: IE5
Here's the code:
open (FILE,">$path$filename"
;
binmode FILE; # for writing to Windows
while (my $byteorder=read($newfile, my $buffer, 1024)) {
$size += $byteorder;
print FILE $buffer;
}
close (FILE);
I figure some programmer much more clever than I has encountered this issue before and resolved it - thanks in advance for your help.
The upload function works great for text and image file uploads and writes them just fine as long as the text file is plain text or HTML.
If I upload a script, it won't execute (yes, permissions are changed to 755 or 777). If I use my FTP client to download the script and reupload - with no modifications whatsoever - it executes perfectly.
I suspect it's an issue with how my script utility is writing the file. Is there a mode I can switch to? Are there hidden characters generated by the browser form field that need to be stripped? Is there a "header" line (or some other string) that needs to precede the while print loop?
Server: Linux/Apache/Perl5
Browser: IE5
Here's the code:
open (FILE,">$path$filename"
binmode FILE; # for writing to Windows
while (my $byteorder=read($newfile, my $buffer, 1024)) {
$size += $byteorder;
print FILE $buffer;
}
close (FILE);
I figure some programmer much more clever than I has encountered this issue before and resolved it - thanks in advance for your help.