Ragazi salve a tutti.
Ho trovato su questo sito uno script che da la possibilità di generare una favicon da un'altra immagine in formato jpg. Solo che non funziona.
Questo è l'errore che mi da:
Warning: move_uploaded_file(uploads/prova.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\Inetpub\webs\robyonwebcom\robyonweb\area_webmas ter\strumenti_webmaster\favicon.php on line 19
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\upload\phpFFAD.tmp' to 'uploads/prova.jpg' in D:\Inetpub\webs\robyonwebcom\robyonweb\area_webmas ter\strumenti_webmaster\favicon.php on line 19
E questo è invece il codice della pagina:
Codice 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['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
// If we have uploaded correctly...
$extensions = array("JPG","jpg","JPEG","jpeg"); //File Types
$check = $target_path;
$explosion = explode(".", $check);
$name = $explosion[0]; //This is the real name of the file
$extension = $explosion[1]; //This is the extension of the full file
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
if (!in_array($extension, $extensions)) {
echo "You have to upload a file ending in .jpg in order for us to generate your favicon";
unlink ($target_path); // delete the original file
} else {
echo "We have successfully generated your icon!
";
// Now actually generate it
$im = imagecreatefromjpeg($target_path);
list($width, $height) = getimagesize($target_path); // get the width and height of the jpg
$image_p = imagecreatetruecolor("16", "16"); // create a 16x16 canvas to play with
imagecopyresampled($image_p, $im, 0, 0, 0, 0, "16", "16", $width, $height); // resize jpg to 16x16
$num = rand (1,99999); // generate a random number between 1 and 99999
$output = $num."-favicon.ico"; // add the number to a string with -favicon.ico
imagepng($image_p,$output); // make a .png file (icon file) from our data
imagedestroy ($im); // close gd library
echo "<a href= \"http://www.swansoninternet.com/phpincludes/$output\"><img src = \"http://www.swansoninternet.com/phpincludes/$output\">
Clicca qui</a> o sull'immagine per scaricare la favicon."; // show our icon with information
unlink ($target_path); // delete the original file
}
} else{
echo "Upload a .jpg file to convert it to a favicon!";
}
?>
<title>Favicon Generator</title>
<style type="text/css">
<!--
body,td,th {
font-family: Tahoma, Helvetica, sans-serif;
font-size: small;
color: #666666;
}
-->
</style><form enctype="multipart/form-data" action="<? $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Carica il file: <input name="uploadedfile" type="file" />
<input type="submit" value="Create Favicon" />
</form>
Questa è la linea 19 che da il problema:
Codice PHP:
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
Vi ringrazio in anticipo per la partecipazione
ciao a tutti
steave67