in reply to Extract and Pass File Upload Value

Hi,

IMHO, think about using sessions, for example CGI::Session. For uploaded files, you can save the file somewhere and store the path in the session. Take a look at FileUpload::Filename to use the same filename as the user gave to the file. You can use the session ID as the directory for storing uploaded files from a given user on the servers filesystem.

Then once the user make the final commit, store it to the final destination, moving it from the temporary location to the final one...

Regards,

fmerges at irc.freenode.net

Replies are listed 'Best First'.
Re^2: Extract and Pass File Upload Value
by Anonymous Monk on Apr 30, 2006 at 20:18 UTC
    I downloaded FileUpload-Filename-0.01 and read the MAN and came to the conclusion that I may not be able to utilize it. However, your advise did lead me to a perl module on CPAN named HTML Validation. With the prior, there are numerous pms required to download eg. Browser Detect... etc, however with the latter there are none.

    I tested the pm at http://www.htmlhelp.org/tools/validator/upload.html.en and it does just what I need it to do without the additional pms - returning the results to an assigned page.

    I already have a system in place where each users data is stored in ./shared.template in their individual directories. When a user fills out a particular form, that form along with the users input is copied to thier directory.

    I need a solution to write the file input value to "whatever.template" after the form is submitted, such as the above url example.

    I have downloaded and reviewed the source code for HTML:Validator, yet have not found a way to neither integrate it with my template.pm (primary code already submitted) nor extract filename as a stand-alone pm.

    If needed I can private message the url to my project.

    Thanks

      Hi,

      I don't understand what you wanna do. Could you explain in a high level what you want to do?

      Regards,

      fmerges at irc.freenode.net
        All I'm really trying to do is capture the name/value pair from the file upload field:

        my $key = ''; foreach $key (keys %$p_upload_files) { my $p_hash = $$p_upload_files{$key}; next unless (($p_hash) and (defined($$p_hash{'server file name'})) +); $FORM{$key . "_filename"} = $$p_hash{'server file name'};

        and merge/save it with the name/value pairs here.
        my %replace = (); $text = ''; my ($name, $value) = (); while (($name, $value) = each %FORM) { $replace{$name} = $value; next if ($name =~ m!^(shared|genesis_system)_!); # separate name-s +paces next if (($name eq 'Action') or ($name eq 'Template') or ($name eq + 'CWD') or ($name eq 'web_auth_cp')); # reversed names $text .= &ue($name) . '=' . &ue($value) . "\n"; } &_load_system_values( \%replace, $FORM{'Template'} ); # save the name-value pairs that are specific to this template: <br> my $datafile = ".$FORM{'Template'}"; $datafile =~ s!/!.!g; $err = &WriteFile( $datafile, $text); next Err if ($err);