in reply to passing fileuploads to more than 1 sub

If I understand you correctly you are trying to put the name of the file in a hidden input on an HTML form and expecting to get that file back. It doesn't work that way, file upload fields in the browser are special, they actually send the data and the user is forced to pick the file themselves (you can't even put a default value in.) This is to ensure someone doesn't force a user to upload sensitive files to the net.

Really I don't understand why you are trying to do it in two parts at all. Why can't you just check the bookmark file for validity, save it in a temporary place on your server, get HTML::TokeParser to immediatly open it and parse it how you want and then return a success or failure message to the browser. You could then unlink the uploaded file so it isn't sitting around on your server.

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Re: passing fileuploads to more than 1 sub
by rabbit55 (Initiate) on Jul 19, 2003 at 05:24 UTC

    Yes, I see. You can not pass a file by putting a filename in a hidden input and then telling the browser to grab the file; that would mean people could grab stuff off your computer at will. A bad thing.

    Why break it down into start_import and finish_import? To present the user with information about the file he selected and allow for further decisions/input based on that before inserting the whole mess into a table.

    Saving to a temp file plus some restructuring of my script's logic sounds like the solution. The initiate thanks his fellow monks and proceeds on the long path of enlightenment for perl-impaired bozos.