Salve ho un server virtuale con Tiscali.
Ho un grosso problema. Nella mia applicazione ho bisogno di uplodare foto da un form html, ma mi dā uno strano errore (codice 7) restituito dall'array $_FILES.
Ecco il codice della pagina che contiene il form:

<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
File to upload:<input type="file" size=40 name="userfile"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Your Name<input type="text" name="realname"><br>
Your Email<input type="text" name="email"><br>
<input type="submit" value="upload">
</form>

Ed ecco il codice della pagina upload.php:
<?php
// Declare variables
// Get the basic file information

$userfile = $_FILES['userfile']['name'];
$file_size = $_FILES['userfile']['size'];
$file_temp = $_FILES['userfile']['tmp_name'];

$file_err = $_FILES['userfile']['error'];
echo "File ".$userfile;
$path = '/home/web/piccolomondoantico-rc.it/website/uploaddir/';
// Create a new file name
// This is so if other files on the server have the same name, it will be renamed
$randomizer = rand(0000, 9999);
$file_name = $randomizer.$userfile;

// Get the file type
// Using $_FILES to get the file type is sometimes inaccurate, so we are going
// to get the extension ourselves from the name of the file
// This also eliminates having to worry about the MIME type
$file_type = $userfile;
$file_type_length = strlen($file_type) - 3;
$file_type = substr($file_type, $file_type_length);

if(!empty($userfile)) {
echo '<div style="font-weight: bold; padding: 6px;">File Uploaded Information</div>
<ul>
<li>Original File Name: ' .$userfile. '</li>
<li>New File Name: ' .$file_name. '</li>
<li>File Type: ' .$file_type.'</li>
<li>File Size: ' .$file_size. '</li>
<li>File Temporary Name: ' .$file_temp. '</li>
<li>Fille Error: ' . $file_err. '</li>
</ul>';

// limit the size of the file to 200KB
if($file_size > 25600) {
echo 'FILE SIZE TO LARGE<BR />';
exit();
}

// Set allowed file types
// Set case of all letters to lower case
$file_type = strtolower($file_type);
$files = array();
$files[] = 'jpeg';
$files[] = 'jpg';
$files[] = 'gif';
$files[] = 'png';
// Search the array for the allowed file type
$key = array_search($file_type, $files);
if($key) {
echo '<b>File allowed!</b><br />';
} else {
echo '<b>ILLEGAL FILE TYPE</b><br />';
exit();
}

// Check for errors and upload the file
$percorso=$path.$file_name;
echo "Nome file compreso di percorso: ".$percorso;
if(move_uploaded_file($file_temp, $percorso)) {
echo '<h3>Upload Successful!</h3>';
} else {
echo '<h3>ERRORE</h3>';
}

} else {
echo '<h3>No file has been selected.</h3>';
}
?>

Potete provare lo script a questo link.

Da cosa potrebbe dipender? Pare che non riesca a creare un file temporaneo....