| 
 Posted by leen on 06/16/13 11:57 
hola.. 
i need a help...this is my coding for uploading multiple files...the 
problem is..i want the files that i have been upload will show in the 
same page but using only one text box..can anyone help me?plz...i 
really need a help.. 
 
<HTML> 
<HEAD> 
<title>FILE UPLOAD</title> 
<body bgcolor="magenta"> 
 
 
 
<form method="POST" ENCTYPE="multipart/form-data" 
action="uploadfile.php"> 
 
 
 
<p> 
Files:<br> 
 
<input type="file" name="uploadFile" size="40"> 
 
<br> 
<input type="file" name="uploadFile2" size="40"> 
</p> 
<p> 
<input type="submit" value="Submit"> 
 
 
<br> 
<br> 
<?php 
 
 
 
// Where the file is going to be placed 
$target_path = "uploads/"; 
 
/* Add the original filename to our target path. 
Result is "uploads/filename.extension" */ 
$target_path = $target_path . basename( $_FILES['uploadFile']['name']); 
 
$_FILES['uploadFile']['tmp_name']; 
 
 
$target_path = "uploads/"; 
 
$target_path = $target_path . basename( $_FILES['uploadFile']['name']); 
 
 
if(move_uploaded_file($_FILES['uploadFile']['tmp_name'], $target_path)) 
{ 
    echo "The file ".  basename( $_FILES['uploadFile']['name']). 
    " has been uploaded     =>    "; 
} else{ 
    echo " "; 
} 
 
$target_path = "uploads/"; 
$target_path = $target_path . basename( $_FILES['uploadFile']['name']); 
$target_name = basename( $_FILES['uploadFile']['name']); 
$dir=" "; 
 
  echo "<a href='{$dir}/{$target_path}'>{$target_name}</a><br />"; 
 
 
 
 
 
 
// Where the file is going to be placed 
$target_path = "uploads/"; 
 
/* Add the original filename to our target path. 
Result is "uploads/filename.extension" */ 
$target_path = $target_path . basename( 
$_FILES['uploadFile2']['name']); 
$_FILES['uploadFile2']['tmp_name']; 
 
 
$target_path = "uploads/"; 
 
$target_path = $target_path . basename( 
$_FILES['uploadFile2']['name']); 
 
if(move_uploaded_file($_FILES['uploadFile2']['tmp_name'], 
$target_path)) { 
    echo "The file ".  basename( $_FILES['uploadFile2']['name']). 
    " has been uploaded   =>  "; 
} else{ 
    echo "  "; 
} 
 
$target_path = "uploads/"; 
$target_path = $target_path . basename( 
$_FILES['uploadFile2']['name']); 
$target_name = basename( $_FILES['uploadFile2']['name']); 
$dir=" "; 
 
  echo "<a href='{$dir}/{$target_path}'>{$target_name}</a><br />"; 
 
 
 
 
?> 
</form> 
 
 
</body> 
</HEAD> 
</HTML>
 
  
Navigation:
[Reply to this message] 
 |