Greetings,

so, first visit, first post so --) here goes:
I am trying to slot an upload routine into an existing database management script so I can include the upload field on the main page (as opposed to a seperated upload page - and script).

So, I am not a coder - just a hacker. BUT, I am a monk - 14 yrs now :))
And, here is my current doodle....
$formdata is the std field defn. for the script I am tweaking
$upload_dir is defined elsewhere
"file" is the upload field name

######____ AK upload from here

$filename = $formdata{"file"}; $filename =~ s/(\s+|\n)?,(\s+|\n)?/,/g; $upload_filehandle = upload($formdata{"file"}); &upload_file; sub upload_file { $filepath=$filename; if ($filepath =~ /([^\/\\]+)$/) {$filename="$1";} else {$filename="$filepath";} $filename =~ s/\s+//g; open UPLOADFILE, ">$upload_dir/$filename"; while ( <$upload_filehandle> ) {print UPLOADFILE;} close UPLOADFILE; } if ($to_upload == 1) {$formdata{'file'} = $filename}; #ensures just fi +lename written to database
######____ AK upload TO here

This writes filename to the database - great!
writes filename to $upload_dir - BUT - a zero file; ie. it doesn't move the bits :(

I am hoping for just a simple module but am open to extended suggestions.

with thanks and blessing
> arfa

Edit by tye, remove BR tags, add "/" to closing CODE tag


In reply to upload mod insert by arfa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.