Hi! I'm trying to import Netscape type bookmark files into a mysql database table using a cgi script, but having a bit of trouble.

I use start_multipart_form to get a file from main program interface, then parse it in a sub called start_import, using HTML::TokeParser to make sure its really a bookmark file, find out how many links and categories it has, and set a few datafields like import date etc. If all is ok, i call another sub called finish_import where I do the inserts.

The script works fine on my home computer, but when I put it up on the server, i get an error from TokeParser at the beginning of finish_import telling me "no such file or directory." In other words, I pass file from main to start_import parse file successfully, then lose file going from start_import to finish_import. Yet I try to do the same thing from main to start and from start to finish.

Main to start I use start_multipart_form and filefield; in start I then get $filename from param(uploaded_file) and feed it to TokeParser; if all is well, I put $filename in a hidden field called uploaded_file and call finish_import; finish import feeds uploaded_file to TokeParser, which then complains as above. I've been working on this for a couple of days now and no dice. (I'm not the fastest worker in the world)

Any ideas?


In reply to passing fileuploads to more than 1 sub by rabbit55

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.