PDA

View Full Version : Perl File Redirection...


jONEz
November 29th, 2002, 04:15 PM
I'm working on an intranet for a local business, and I've run into a small problem. Here's a rundown of what's going on;

User selects two files (from form), and clicks upload button. This spawns preload.cgi in a popup, which generates a frameset. The top frame is a loading image, and the bottom frame is another perl script (upload.cgi).

The bottom frame uploads the content, and when it completes the generated page (from upload.cgi) changes the content of the top frame to display a completed image.

The problem is, the frameset generated by preload.cgi loads one static page (framesrc="loading.html") whereas the bottom frame loads the upload.cgi (framesrc="/cgi-bin/upload.cgi?File1=....")

When I pass the file locations using this method I think I'm loosing the form enctype (multipart/form-data).

How can I use a manual post (eg. framesrc="blah.cgi?File1=...") and have the second script use the correct enctype?

Any help/suggestions are greatly appreciated!!!

I know this may sound confusing but it was the only way I could think of to have a loading image while a user uploads files, and change it (to a completed image) once the upload has finished.

Steven.Bentley
November 29th, 2002, 08:26 PM
hi jONEz, welcome :)

I've never used perl myself, strictly a PHP man when it comes to server side coding, but I'm sure someone will be able to help :)

jONEz
November 30th, 2002, 03:04 PM
Thanks :)

I'm trying things like this;

<frame src="/cgi-bin/upload.cgi?File1=$file1path..." method="POST">
<frame src="/cgi-bin/upload.cgi?method=POST....>
<frame src="/cgi-bin/upload.cgi?request_method=POST....>

Those don't work obviously, didn't think it would but hey you never know.

I've also tried saving the current state of my CGI from preload.cgi;
$query->save("test.in") and the reloading it in upload.cgi; open (IN,"test.in") || die; restore_parameters(IN); close IN; but can't seem to get it to work...

Basically the two things I need are to somehow tell that link above that it's being posted, and it's enctype=multipart/form-data.

Or if there is some way to use HTML as the framesrc (then I could just generate a empty page from preload.cgi and submit the form in body onLoad) instead of using a link.

Or is there a way to redirect my CGI state from preload.cgi to upload.cgi?

Anyone?

jONEz
December 1st, 2002, 04:38 AM
Never mind I had to do it a different way, calls embedded in links to a cgi file always use GET. I had it almost working another way but I found out you can't set input file tags in JS; for obvious reasons I never thought of.

I got it working with less Perl and more JavaScript, took a while but now I get to sleep :o