You are here: upload multiple files... « PHP Programming Language « IT news, forums, messages
upload multiple files...

Posted by leen on 11/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация