Basically I'm looking at some existing code used to upload images/files, can you help me understand exactly what is happening:
Expand|Select|Wrap|Line Numbers
- sub set_asset {
- my %arg = @_;
- my $customer = $arg{customer};
- my $copied = copy(
- $arg{filename},
- $customer->path."/assets/".$arg{destination}
- ) or die "Cannot copy $arg{filename}: $!\n";
- my ($number, @error);
- if ($arg{destination} =~ /\.(jpg|gif|jpeg|png|bmp|swf)$/i) {
- ($number, @error) = createThumbnail($arg{folder}, $customer);
- }
- return ($number, @error);
- }
- sub destination_filename {
- my $full_path = shift;
- my @opParts = splitdir $full_path;
- my $filename = $opParts[-1];
- $filename =~ tr/ /_/;
- return $filename;
- }