> Hi all.

Howdy

> 
> 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.\

Th "Other way" doesn't handle the size of the file being uploaded it helps 
write it in smaller chunks.
CGI.pm will let you restrict the file to a certain size but the "Other way" writes
To the new file in smaller chunks no matter if the uploaded file is 1K or 1Mb.

Now that we have that all sorted not sure exactly what the pros and cons of 
each are as I don't do to much file uploading. But the small amount I do is pretty 
much your "Other way" method.

HTH

DMuey

> 
> 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]
> 
> 

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

Reply via email to