PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > a tricky one (or not) about form submission
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
a tricky one (or not) about form submission

Réponse
 
LinkBack Outils de la discussion
Vieux 14/02/2008, 15h05   #1
henribaeyens
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut a tricky one (or not) about form submission

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?
  Réponse avec citation
Vieux 14/02/2008, 15h12   #2
Jeremy@thebunnyshed.co.uk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

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?
  Réponse avec citation
Vieux 14/02/2008, 15h12   #3
Iván Sánchez Ortega
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

henribaeyens wrote:

> 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?


$_SESSION data is already in the server - why would you want to re-upload
it?

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

Proudly running Debian Linux with 2.6.24-1-amd64 kernel, KDE 3.5.8, and PHP
5.2.5-2 generating this signature.
Uptime: 16:12:22 up 3:47, 2 users, load average: 0.59, 0.82, 0.95

  Réponse avec citation
Vieux 14/02/2008, 18h26   #4
henribaeyens
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

On Thu, 14 Feb 2008 07:12:04 -0800, Jeremy wrote:

> 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?


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.
  Réponse avec citation
Vieux 14/02/2008, 18h30   #5
henribaeyens
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

On Thu, 14 Feb 2008 16:12:47 +0100, Iván Sánchez Ortega wrote:

> henribaeyens wrote:
>
>> 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?

>
> $_SESSION data is already in the server - why would you want to
> re-upload it?


session data yes, but not the actual files. I need to make the submit
"aware" of the $_FILES array
  Réponse avec citation
Vieux 14/02/2008, 19h30   #6
Iván Sánchez Ortega
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

henribaeyens wrote:

> 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 store it in $_SESSION ....

> You can pass along any input types but the file input type.


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

> The file's information may be on the server but not its content because
> the actual file uploading is not done yet.


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?

> 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.


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.
  Réponse avec citation
Vieux 14/02/2008, 20h29   #7
Tony
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

henribaeyens wrote:
> On Thu, 14 Feb 2008 07:12:04 -0800, Jeremy wrote:
>
>> 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?

>
> 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.


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.
  Réponse avec citation
Vieux 15/02/2008, 03h08   #8
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: a tricky one (or not) about form submission

henribaeyens wrote:
> On Thu, 14 Feb 2008 16:12:47 +0100, Iván Sánchez Ortega wrote:
>
>> henribaeyens wrote:
>>
>>> 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?

>> $_SESSION data is already in the server - why would you want to
>> re-upload it?

>
> session data yes, but not the actual files. I need to make the submit
> "aware" of the $_FILES array
>


Yes, the actual files on on the server. They were uploaded when the
user submitted the form with the FILE info.

It's temporarily stored in the temp name. If you don't move it to a
permanent location before this page ends (with move_uploaded_file), the
file is discarded.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h42.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15688 seconds with 16 queries