Uploading problem--with COde

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
keshavmix
Forum Newbie
Posts: 3
Joined: Sun Jan 06, 2008 11:32 am

Uploading problem--with COde

Post 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;
?>
 
Last edited by keshavmix on Sun Aug 31, 2008 1:35 am, edited 1 time in total.
User avatar
Jaxolotl
Forum Contributor
Posts: 137
Joined: Mon Nov 13, 2006 4:19 am
Location: Argentina and Italy

Re: Uploading problem

Post 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
keshavmix
Forum Newbie
Posts: 3
Joined: Sun Jan 06, 2008 11:32 am

Re: Uploading problem

Post by keshavmix »

plz help me i hav posted code now..
Post Reply