Upload Files with table

Hello!!

My problem today is this one

File Download
file1.pdf yes
file2.doc yes

The idea is this one , One user wants to upload a file a pdf or .doc file and that file can be displayed in another php page. where a second user can download a specific file.

I create two php files and I have a result , but its not a table and is missing the “yes” download link

A simple view of the upload


<h1>Files</h1>
<form action="viewfiles.php" method="post" enctype="multipart/form-data">
<p><strong>Upload files:</strong><br /> 
<input type="file" name="file" size="700" id="file"></p>
<p>
<input type="submit" value="Upload" />
</p>

the second file with the view of the table with pdf or doc:

viewfiles.php
[php]

if ($_FILES)
{
$name = $_FILES[‘file’][‘name’];
switch($_FILES[‘file’][‘type’])
{
case ‘application/pdf’: $ext = ‘pdf’; break;
case ‘application/msword’: $ext = ‘doc’; break;
default: $ext = ‘’; break;
}
if ($ext)
{
echo ‘

’;
echo "


";

$n = “application.$ext”;
move_uploaded_file($_FILES[‘file’][‘tmp_name’], $n);
echo ‘

’;
foreach ($name as $n){
echo “”;
}
echo ‘’;
}
else echo “’$name’ This file is not a pdf or doc”;
}
else echo “File not uploaded”;

[/php]

the result:

Array ( [file] => Array ( [name] => book.pdf [type] => [tmp_name] => [error] => 1 [size] => 0 ) )
‘book.pdf’ is not a pdf or doc.

So whats wrong? , besides the table is in a bad position.

thanks for the help

Name Download
’."$name yes" . ‘

I really need help with my problem.

Sponsor our Newsletter | Privacy Policy | Terms of Service