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
$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);