Buongiorno, ho creato il seguente script che deve fare l'update di 2 file che gli sono passati dall'utente; il probelama è che i 2 file non vengono caricati sul server e si generano i seguenti errori:
- Warning: move_uploaded_file(/fileprovainvio.txt): failed to open stream: Permission denied in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 58
-Warning: move_uploaded_file(): Unable to move '/tmp/php7IWbok' to '/fileprovainvio.txt' in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 58
-Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/youcurriculum.it/httpdocs/paga.php:38) in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 61
-Warning: move_uploaded_file(/filefavicon.ico.png): failed to open stream: Permission denied in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 73
-Warning: move_uploaded_file(): Unable to move '/tmp/phpvPz0PO' to '/filefavicon.ico.png' in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 73
-Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/youcurriculum.it/httpdocs/paga.php:38) in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 76
Dove sbaglio?
questo è lo script in php:
Grazie per l'aiuto
- Warning: move_uploaded_file(/fileprovainvio.txt): failed to open stream: Permission denied in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 58
-Warning: move_uploaded_file(): Unable to move '/tmp/php7IWbok' to '/fileprovainvio.txt' in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 58
-Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/youcurriculum.it/httpdocs/paga.php:38) in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 61
-Warning: move_uploaded_file(/filefavicon.ico.png): failed to open stream: Permission denied in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 73
-Warning: move_uploaded_file(): Unable to move '/tmp/phpvPz0PO' to '/filefavicon.ico.png' in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 73
-Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/youcurriculum.it/httpdocs/paga.php:38) in /var/www/vhosts/youcurriculum.it/httpdocs/paga.php on line 76
Dove sbaglio?
questo è lo script in php:
PHP:
<?php
// controllo grandezza dei 2 allegati
if (($_FILES["cv"]["size"] > 2000000)) // Dimensione massima: 2MB
{
$err = 1 ;
header("location:contatti.php?err=$err");
} elseif(($_FILES["foto"]["size"] > 2000000)){
$err = 2 ;
header("location:contatti.php?err=$err");
} else {
//caricamento cv
$target_dir = '/file';
$target_file = $target_dir . basename($_FILES["cv"]["name"]);
$uploadOk = 1;
// controlla se esiste un file con lo stesso nome; altrimenti carica il file foto
if (file_exists($target_file)) {
$err = 3 ;
header("location:contatti.php?err=$err");
$uploadOk = 0;
}else {
if (move_uploaded_file($_FILES["cv"]["tmp_name"], $target_file)) {
} else {
$err = 4 ;
header("location:contatti.php?err=$err");
}
}
//caricamento foto
$target_file = $target_dir . basename($_FILES["foto"]["name"]);
$uploadOk = 1;
// controlla se esiste un file con lo stesso nome; altrimenti carica il file cv
if (file_exists($target_file)) {
$err = 5 ;
header("location:contatti.php?err=$err");
$uploadOk = 0;
}else {
if (move_uploaded_file($_FILES["foto"]["tmp_name"], $target_file)) {
} else {
$err = 6 ;
header("location:contatti.php?err=$err");
}
}
?>