Page 1 of 1

Uploading problem--with COde

Posted: Sat Aug 30, 2008 11:00 am
by keshavmix
Hello frndz, i hav 3 php files. 1) index.php, 2) confirm.php and 3) upload.php.

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

Re: Uploading problem

Posted: Sat Aug 30, 2008 11:23 am
by Jaxolotl
How could we ever help you without knowing your code my friend?
Please, remove everything relating your db connection or any personal ecurity information from the scripts and post them here so we can take a look, otherwise it would be a kind of magic to solve you problem. 8O

Re: Uploading problem

Posted: Sun Aug 31, 2008 1:36 am
by keshavmix
plz help me i hav posted code now..