step1: user can select file to upload at index.php then click on submit. the form submited to the confirm.php page.
Step2: At confirm.php, there is another submit button. user can click on confirm button to move to upload.php. (but upload function is not at confirm.php..)
i want to upload a file after clicking on confirm button at confirm.php page and the file has been already select by the user at index.php.
step3: upload.php contains mysql queries n upload functions etc..
plz help meee..
here is
index.php
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="jquery.js" type="text/javascript" language="javascript"></script>
<script src="jquery.MultiFile.js" type="text/javascript" language="javascript"></script>
</head>
<body>
<form method="post" action="step2.php" enctype="multipart/form-data">
<input name="filex[]" type="file" />
<input name="uploadx" type="submit" value="Upload" />
</form>
</body>
</html>confirm.php
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script src="jquery.js" type="text/javascript" language="javascript"></script>
<script src="jquery.MultiFile.js" type="text/javascript" language="javascript"></script>
</head>
<body>
<form method="post" action="upload.php" enctype="multipart/form-data">
<input name="file[]" type="hidden" value="<?php echo $_POST['file']; ?>" />
<input name="uploadx" type="submit" value="Upload" />
</form>
</body>
</html>
and finally upload.php
Code: Select all
<?
$dbfile ="";
$pname = "P1";
mkdir("upload/$pname/");
while(list($key,$value) = each($_FILES['filex']['name']))
{
if(!empty($value))
{
$filename = "$pname_".time()."_".$value;
$filename=str_replace(" ","_",$filename);
$add = "upload/$pname/$filename";
copy($_FILES['filex']['tmp_name'][$key], $add);
chmod("$add",0777);
$dbfile.=$filename."," ;
}
}
echo $dbfile;
?>