wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r8249: Change getting params from multipart for...

Committer: gprochaev
Change getting params from multipart form

U   trunk/htdocs/admin/vgift/edit.bml
Modified: trunk/htdocs/admin/vgift/edit.bml
===================================================================
--- trunk/htdocs/admin/vgift/edit.bml	2010-03-04 06:35:54 UTC (rev 8248)
+++ trunk/htdocs/admin/vgift/edit.bml	2010-03-04 07:08:18 UTC (rev 8249)
@@ -31,9 +31,16 @@
 if ($mode eq "changevgift") {
     if (LJ::did_post()) {
         my $error = '';
-        BML::parse_multipart(\%POST, \$error, 999992048);
-        warn "ERROR: $error" and return $error if $error;
+        #BML::parse_multipart(\%POST, \$error, 999992048);
+        #warn "ERROR: $error" and return $error if $error;
+        my $large_file = LJ::Request->upload('vgift_content_large');
+        seek $large_file->fh, 0,0;
+        read $large_file->fh, my $large_file_content, $large_file->size;
 
+        my $small_file = LJ::Request->upload('vgift_content_small');
+        seek $small_file->fh, 0,0;
+        read $small_file->fh, my $small_file_content, $small_file->size;
+
         my $vgift;
 
         ## Set boolean params
@@ -76,7 +83,7 @@
             $magic = substr $POST{'vgift_content_large'}, 0, 20;
             $mime_type = format_magic($magic)
                 or die "Unknown format for upload";
-            $result_l = LJ::FileStore->save_file(path => "/vgift/" . $vgift->id . "/large", content => $POST{'vgift_content_large'}, mime_type => $mime_type, content_length => $content_length);
+            $result_l = LJ::FileStore->save_file(path => "/vgift/" . $vgift->id . "/large", content => $large_file_content, mime_type => $mime_type, content_length => $content_length);
         }
         
         ## Set small image
@@ -85,7 +92,7 @@
             $magic = substr $POST{'vgift_content_small'}, 0, 20;
             $mime_type = format_magic($magic)
                 or die "Unknown format for upload";
-            $result_s = LJ::FileStore->save_file(path => "/vgift/" . $vgift->id . "/small", content => $POST{'vgift_content_small'}, mime_type => $mime_type, content_length => $content_length);
+            $result_s = LJ::FileStore->save_file(path => "/vgift/" . $vgift->id . "/small", content => $small_file_content, mime_type => $mime_type, content_length => $content_length);
         }
        
         my $cat_name = LJ::Pay::ShopVGift::get_cat_name($vgift_cats->[0]->{cat_id});

Tags: bml, ljcom, wisest-owl
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments