Hi all.

I need some advice on this.

I'm writing a script for uploading a file ($file). Saving it as
$file_path/$name

The way I'm doing this right now is (after checking the file extensión and
assuring every character is only a letter or an underscore):

-My way----------------------------------------
open(LOCAL, ">$file_path/$name") or die $!;
   while(<$file>) {
      print LOCAL $_;
   }
--------------------------------------------------


But I have found this other way to do it:
-Other way--------------------------------------
open (LOCAL,">$file_path/$name") or die $!;
  while ($bytesread=read($file,$buffer,1024)) {
      print LOCAL $buffer;
  }
-------------------------------------------------

The 'Other way' helps to handle the size of the file been uploaded, but I'm
using CGI.pm for doing that, resticting the size.

I really don't know wich of them both is better. Or what are the main
advantages (or disadvantages) for each one. I have tried my script with many
files (Images in my case) and I have set some security controls to prevent
uploading other than images files, but really can't figure where could the
main advantege be in these two pieces of code.

Can you all folks give me some comments on this??.

Maybe I'm losing something and there's an even better way to do it.

Your help is very appreciated
-rm-


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to