?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?Passing fform variable to 2nd form on same page
Author:??(---.dsl.lsan03.pacbell.net)
Date:???10-12-03 20:38

I have a php form that allows users to upload an image to my server. On Submit, this form reloads the page and displays all uploaded images in the upload folder.

I have a second form on the page that I want to place the name of the uploaded file into. What is the best way to do this? I would rather not use a session solution because I think that requires cookies. Is there a way to read the file name in the variable the_file into a persistant variable before the page reloads. Or, when the page reloads and displays all of the images in the uploads folder, can I assign the last element returned to a field in the second form? Would this be reliable, what if 2 people submitted images at the same time?

Here is the function that creates the input form to upload the file:

function form($error=false)
{
print "
";
global $PHP_SELF,$my_max_file_size;

if ($error) print $error . "

";


print "\n
";
print "\n";
print "\n";

print "\n
NOTE: Max file size is " . ($my_max_file_size /1024) . "KB";
print "\n
";
print "";
print "\n
";
print '
';

And here is the function that displays the files after a file is uploaded:

function list_files() {

global $the_path;

$handle = dir($the_path);
print "\nUploaded Pictures waiting to be placed online:
";
while ($file = $handle->read()) {
if (($file != ".") && ($file != "..")) {
print "\n" . $file . "
";
}
}
print "
";
}

Or, can I display verification that the file uploaded without reloading the page(in other words, without submitting to self) and then assign the variable the_file to a field in the second form? Thank you for any help.

brad

?Topics Author? Date
?Passing fform variable to 2nd form on same page??new
Brad 10-12-03 20:38?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > I have a php form that allows users to upload an image to my > server. On Submit, this form reloads the page and displays > all uploaded images in the upload folder. > > I have a second form on the page that I want to place the > name of the uploaded file into. What is the best way to do > this? I would rather not use a session solution because I > think that requires cookies. Is there a way to read the file > name in the variable the_file into a persistant variable > before the page reloads. Or, when the page reloads and > displays all of the images in the uploads folder, can I > assign the last element returned to a field in the second > form? Would this be reliable, what if 2 people submitted > images at the same time? > > Here is the function that creates the input form to upload > the file: > > function form($error=false) > { > print " align='center'>
"; > global $PHP_SELF,$my_max_file_size; > > if ($error) print $error . "

"; > > > print "\n
$PHP_SELF . "\" method=\"post\">"; > print "\n value=\"" . $my_max_file_size . "\">"; > print "\n value=\"upload\">"; > > print "\n
NOTE: Max file size is " . ($my_max_file_size > /1024) . "KB"; > print "\n
SIZE=\"40\"> "; > print " the Picture\" >"; > print "\n
"; > print '
'; > > And here is the function that displays the files > after a file is uploaded: > > function list_files() { > > global $the_path; > > $handle = dir($the_path); > print "\nUploaded Pictures waiting to be placed > online:
"; > while ($file = $handle->read()) { > if (($file != ".") && ($file != "..")) { > print "\n" . $file . "
"; > } > } > print "
"; > } > > Or, can I display verification that the file uploaded without > reloading the page(in other words, without submitting to > self) and then assign the variable the_file to a field in the > second form? Thank you for any help. > > brad ">??

Provided By
Phorum