|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
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 ================== |
|
![]() |
| Outils de la discussion | |
|
|