Click here to get back home

a tricky one (or not) about form submission

 HomeNewsGroups | Search

comp.lang.php - PHP programming language discussions 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
a tricky one (or not) about form submission henribaeyens 02-14-2008
Posted by henribaeyens on February 14, 2008, 10:05 am
Please log in for more thread options
Hi,
First, I don't really need if this should go to this group or to some
others. It's more about methodology and involves both php and javascript.

Say I went thru a series of forms, each time validating and, in some
cases, manipulating the data (which includes files to be uploaded at a
later point) and saving those in the $_session array, which thus contains
$_POST data as well as $_FILES data.
Now, the last stage involves triggering a form input with some javascript
code

document.the_form.action = path_to_upload_script;
document.the_form.submit();

How can I link the_form to what's in $_session?
I mean, I could put the data in hidden inputs and then trigger the submit
but what about files? I can't place them in hidden fields, can I?

Posted by Jeremy on February 14, 2008, 10:12 am
Please log in for more thread options
I'm not sure what you mean. How can you have $_FILES data in the
session? Surely the file will be uploaded when the associated form is
first POSTed?

Posted by henribaeyens on February 14, 2008, 1:26 pm
Please log in for more thread options
On Thu, 14 Feb 2008 07:12:04 -0800, Jeremy wrote:

show/hide quoted text

ok, i was a tad unclear. What I'm looking for essentially is a way to
pass file input from form to form. Say you browse for a file in multipart/
form-data,then you get an array with its name, tmp name, size and so on,
right? So how do you pass along this information? You can pass along any
input types but the file input type.
The form in which I enter the files is validated by a php script then I
need to keep this information for another form that, upon submission,
will be handled by a perl script. The file's information may be on the
server but not its content because the actual file uploading is not done
yet.

The simple alternative would be to submit the form directly to the cgi
(ie without going thru the php manipulation and reentry) but I'll try to
make this work nonetheless.

Posted by =?ISO-8859-15?Q?Iv=E1n_S=E1nch on February 14, 2008, 2:30 pm
Please log in for more thread options
henribaeyens wrote:

show/hide quoted text

You store it in $_SESSION ....

show/hide quoted text

Yeah, 'cause you get that by running the "file" command on an unix system.

show/hide quoted text

Wrong. Whenever you submit a file, it gets on the server - do you think that
the temporary name of the file is created from thin air?

show/hide quoted text

May I suggest using CURL to make PHP post all the data saved in the
$_SESSION, plus the files (provided you moved them out of their temporary
placement) to the perl script ?


--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.

Posted by Tony on February 14, 2008, 3:29 pm
Please log in for more thread options
henribaeyens wrote:
show/hide quoted text

Can't be done with HTML/PHP/JS. There is no possible way to set the
value of a file-type input, which is what you need to do. Might be
doable with Flash/Flex.

Similar ThreadsPosted
Form value submission problems March 8, 2006, 9:03 pm
Alternative form submission February 10, 2007, 10:58 am
Capturing results of a Form Submission November 12, 2004, 3:27 am
Is it possible to handle form submission in the same file? January 23, 2008, 6:58 pm
Suppress for form submission? April 4, 2008, 11:50 am
form showing old session values after submission November 5, 2008, 4:23 pm
Saving the values of form elements after an incomplete submission January 21, 2006, 2:24 pm
Scripted search engine submission - how? May 22, 2005, 5:36 am
FF triggering $_POST array even on no submission? March 3, 2009, 2:14 pm
tricky /n October 25, 2004, 2:24 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy