Hi everyone,
I need help to find my error.
I have the following programs where I try to upload a pdf file to save it in a folder in my website, but is saving a file with a strange file name.

PHP Code:
include("vars.php");
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

foreach( $_FILES as $file_name => $file_array 
{
echo 
"name: ".$file_array['name']."<br />\n";
echo 
"type: ".$file_array['type']."<br />\n";
echo 
"tmp_name: ".$file_array['tmp_name']."<br />\n";
echo 
"error: ".$file_array['error']."<br />\n";
echo 
"size: ".$file_array['size']."<br />\n";
// print_r($_FILES);

$tmp_name $file_array['tmp_name'];

if( 
strstr$tmp_name"/tmp/" ) ) {
    
$tmp_name str_replace("/tmp/"""$tmp_name); # strip location from name
}

foreach ( 
$allowedExts as $acceptThis ) {
if(
is_uploaded_file$file_array['name'] ) && $file_array['type'] == "application/$acceptThis) {

$size=$file_array['size'];
if(
$size $maxSize)
//if($size > $maxImageSize) viejo
{
exit(
"The pdf file is too large in size.");
}

move_uploaded_file$file_array['name'], "$file_dir/$name")
or die(
"Couldn't Copy");
echo 
"<img src=\"$file_url/".$name."\">";
echo 
"<br />\n\n";

// End Foreach loop 2

// End IF statement

// End Foreach loop 1 
HTML Code:
<form action="<?php echo "$self"; ?>" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo "$maxSize"; ?>">
<input type="file" name="fupload">
<input type="submit" value="Upload">
<br />
</form>
This is my second file:
PHP Code:
# vars.php
/*
 *  Maximum Size an image may be
 *
 *  $maxImageSize
 *
 *  51200 = 50 KB
 *  512000 = 500 KB
 *
 */

$maxSize "512000";
//$maxImageSize = "512000"; 



/*
 *  Path Information
 *
 *  1.) $file_dir
 *
 *  2.)$file_url
 *
 *  1.) full path ex /home/user/public_html/images
 *
 *  2.) full url ex http://www.site.com/images
 *
 *  NO TRAILING SLASH!!
 * Directory to move images to should be chmod 777
 *
 */

$file_dir "download/";
$file_url "http://www.issosua.com/download/";

/*
 *  Defining accepted Image Types
 *
 *  Add more like shown below: 
 *
 *  $acceptedImageType[] = "type";
 *
 */

$allowedExts = array("pdf");
$allowedFileType "application/pdf";
//$acceptedImageType = array ("pdf");
//$acceptedImageType[] = "application";

/*
 *  Defining a Page's Own URL
 *
 *  $self=$_SERVER['PHP_SELF'];
 *
 */

$self=$_SERVER['PHP_SELF']; 
Thanks in advance!!