Problema Risolto Modifica Upload System

RE: Modifica Upload System

#1
Ciao @chack1172 , prima abbiamo lavorato sulla pagina di Upload, che doveva rimanere nascosta agli ospiti. Io in questa pagina ci ho messo, appunto, un sistema di Upload.

upload.php
Codice:
<?php
session_start();

require_once('../lib/Users.class.php');
$login = New Users;
$login->access_denied();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Upload</title>
    
    <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css">
    <link rel="stylesheet" href="/threedice-on/css/style2.css">
    <link rel="shortcut icon" href="https://poke-world.net/threedice-on/favicon.ico" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery-scrolltofixed-min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
              $('.nav').scrollToFixed();
        });
    </script>
</head>
<body>

<div class="wrapper">
    <div class="header">
        <?php if($login->is_logged()) : ?>
        <span class="reglog">Ciao <b><?php echo $login->get_username(); ?></b>!&nbsp;&nbsp;<span class="logr"><?php echo $login->get_link_logout(); ?></span></span>
        <?php else: ?>
        <span class="reglog"><p><b><a href="http://poke-world.net/threedice-on/login.php">Accedi</a></b> se hai un Account!</p><p><b><a href="http://poke-world.net/threedice-on/registrazione.php">Registrati</a></b> a 3Dice-on per accedere a tutti i nostri Servizi!</span></p>
        <?php endif; ?>
    </div>
    <div class="nav">
      <span class="navitem"><a href="http://poke-world.net/threedice-on/">Home</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/">Oneiroi</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/news.php">Notizie</a></span>&nbsp;
     <?php if($login->is_logged()) : ?><span class="navitem2"><a href="http://poke-world.net/threedice-on/oneiroi/upload.php">Upload</a></span>&nbsp;<?php endif; ?>
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/supporto.php">Supporto</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/about-us.php">Chi Siamo</a></span>
    </div>
    <div class="content">
       <center><span class="title">Upload - Carica un Sogno!</span></center>
        <br>
        <p>
<p>Carica i tuoi Sogni: gli altri giocatori potranno viverli!</p><br>
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?>
<p><form action="upload.php" method="post" enctype="multipart/form-data">
    Select image to upload:
    <input type="file" name="fileToUpload" id="fileToUpload">
    <input type="submit" value="Upload Image" name="submit">
</form></p>
           
        </p>
    </div>
</div>

</body>
</html> 
qui puoi vedere tutto.
Ti spiego il mio intento. Ora puoi caricare un immagine. Io voglio fare una modifica, e vorrei che mostrasse l'immagine prima di inviarla. 
Altra modifica, vorrei che nello stesso upload non si caricasse solo un immagine, ma anche un file di un altro tipo, file .json. Cioè nello stesso upload io devo poter inviare sia un'immagine che un file .json.
Poi vorrei che si desse un nome al contenuto che si sta per inviare, che può essere scelto dall'utente.
Ho pensato che non basterà la cartella uploads per tutti i file, ma credo, e CREDO, non sono sicuro, servirà anche una Tabella SQL.

Tutto ciò per fare cosa? per far comparire nella Home il file scaricabile, con il relativo screenshot dato dall'immagine scelta prima, con il nome scelto.

Partiamo dall'inizio senza troppi intrecci, bisognerebbe aggiungere la possibilità di selezionare non solo il file immagine, ma anche di altro tipo, quindi .json.
Attenzione: non che l'utente deve scegliere se prendere un Json o un Immagine, ma deve scegliere sia immagine che json per poter inviare.
Esempio:

PREMI QUI PER SELEZIONARE IMMAGINE


PREMI QUI PER SELEZIONARE FILE JSON

INVIA I DATI

spero si sia capito. io non ho idea di come fare, potreste aiutarmi?
 

RE: Modifica Upload System

#2
Dal codice che hai inviato risulta che hai solo un input di tipo file, devi farne 2
Citazione:Noi non possiamo aiutare tutti, ma tutti possono aiutare qualcuno
 

RE: Modifica Upload System

#3
dal codice html? o devo scrivere qualcosa in php?
 

RE: Modifica Upload System

#4
Devi creare anche il codice php (uguale a quello del primo file)
Citazione:Noi non possiamo aiutare tutti, ma tutti possono aiutare qualcuno
 

RE: Modifica Upload System

#5
ci provo
Wink
 

RE: Modifica Upload System

#6
Codice:
<?php
session_start();

require_once('../lib/Users.class.php');
$login = New Users;
$login->access_denied();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Upload</title>
    
    <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css">
    <link rel="stylesheet" href="/threedice-on/css/style2.css">
    <link rel="shortcut icon" href="https://poke-world.net/threedice-on/favicon.ico" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery-scrolltofixed-min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
             $('.nav').scrollToFixed();
        });
    </script>
</head>
<body>

<div class="wrapper">
    <div class="header">
        <?php if($login->is_logged()) : ?>
       <span class="reglog">Ciao <b><?php echo $login->get_username(); ?></b>!&nbsp;&nbsp;<span class="logr"><?php echo $login->get_link_logout(); ?></span></span>
       <?php else: ?>
       <span class="reglog"><p><b><a href="http://poke-world.net/threedice-on/login.php">Accedi</a></b> se hai un Account!</p><p><b><a href="http://poke-world.net/threedice-on/registrazione.php">Registrati</a></b> a 3Dice-on per accedere a tutti i nostri Servizi!</span></p>
       <?php endif; ?>
    </div>
    <div class="nav">
     <span class="navitem"><a href="http://poke-world.net/threedice-on/">Home</a></span>&nbsp;
      <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/">Oneiroi</a></span>&nbsp;
      <span class="navitem"><a href="http://poke-world.net/threedice-on/news.php">Notizie</a></span>&nbsp;
    <?php if($login->is_logged()) : ?><span class="navitem2"><a href="http://poke-world.net/threedice-on/oneiroi/upload.php">Upload</a></span>&nbsp;<?php endif; ?>
      <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/supporto.php">Supporto</a></span>&nbsp;
      <span class="navitem"><a href="http://poke-world.net/threedice-on/about-us.php">Chi Siamo</a></span>
    </div>
   <div class="content">
      <center><span class="title">Upload - Carica un Sogno!</span></center>
       <br>
       <p>
<p>Carica i tuoi Sogni: gli altri giocatori potranno viverli!</p><br>
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
   $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
   if($check !== false) {
       echo "File is an image - " . $check["mime"] . ".";
       $uploadOk = 1;
   } else {
       echo "File is not an image.";
       $uploadOk = 0;
   }
}
// Check if file already exists
if (file_exists($target_file)) {
   echo "Sorry, file already exists.";
   $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
   echo "Sorry, your file is too large.";
   $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
   echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
   $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
   echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
   if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
       echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
   } else {
       echo "Sorry, there was an error uploading your file.";
   }
}

$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
   $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
   if($check !== false) {
       echo "File is an image - " . $check["mime"] . ".";
       $uploadOk = 1;
   } else {
       echo "File is not an image.";
       $uploadOk = 0;
   }
}
// Check if file already exists
if (file_exists($target_file)) {
   echo "Sorry, file already exists.";
   $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
   echo "Sorry, your file is too large.";
   $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
   echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
   $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
   echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
   if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
       echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
   } else {
       echo "Sorry, there was an error uploading your file.";
   }
}
?><br>
<p><form action="upload.php" method="post" enctype="multipart/form-data">
   
   Seleziona l'immagine da Inviare:
   <input type="file" name="fileToUpload" id="fileToUpload"><br><br>
   Seleziona il file .json da inviare:
   <input type="file" name="fileToUpload" id="fileToUpload"><br><br>
   
   <input type="submit" value="Invia" name="submit">
</form></p>
         
       </p>
   </div>
</div>

</body>
</html>
meglio di questo non sono riuscito a fare :/ cosa e come dovrei modificare?
 

RE: Modifica Upload System

#7
I due input devono avere name e id diversi
Citazione:Noi non possiamo aiutare tutti, ma tutti possono aiutare qualcuno
 

RE: Modifica Upload System

#8
(05-09-2016, 18:55)chack1172 Ha scritto: I due input devono avere name e id diversi


Codice:
<?php
session_start();

require_once('../lib/Users.class.php');
$login = New Users;
$login->access_denied();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Upload</title>
    
    <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css">
    <link rel="stylesheet" href="/threedice-on/css/style2.css">
    <link rel="shortcut icon" href="https://poke-world.net/threedice-on/favicon.ico" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery-scrolltofixed-min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
              $('.nav').scrollToFixed();
        });
    </script>
</head>
<body>

<div class="wrapper">
    <div class="header">
        <?php if($login->is_logged()) : ?>
        <span class="reglog">Ciao <b><?php echo $login->get_username(); ?></b>!&nbsp;&nbsp;<span class="logr"><?php echo $login->get_link_logout(); ?></span></span>
        <?php else: ?>
        <span class="reglog"><p><b><a href="http://poke-world.net/threedice-on/login.php">Accedi</a></b> se hai un Account!</p><p><b><a href="http://poke-world.net/threedice-on/registrazione.php">Registrati</a></b> a 3Dice-on per accedere a tutti i nostri Servizi!</span></p>
        <?php endif; ?>
    </div>
    <div class="nav">
      <span class="navitem"><a href="http://poke-world.net/threedice-on/">Home</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/">Oneiroi</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/news.php">Notizie</a></span>&nbsp;
     <?php if($login->is_logged()) : ?><span class="navitem2"><a href="http://poke-world.net/threedice-on/oneiroi/upload.php">Upload</a></span>&nbsp;<?php endif; ?>
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/supporto.php">Supporto</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/about-us.php">Chi Siamo</a></span>
    </div>
    <div class="content">
       <center><span class="title">Upload - Carica un Sogno!</span></center>
        <br>
        <p>
<p>Carica i tuoi Sogni: gli altri giocatori potranno viverli!</p><br>
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}

$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?><br>
<p><form action="upload.php" method="post" enctype="multipart/form-data">
    
    Seleziona l'immagine da Inviare:
    <input type="file" name="fileToUpload" id="fileToUpload"><br><br>
    Seleziona il file .json da inviare:
    <input type="file" name="jsonToUpload" id="jsonToUpload"><br><br>
    
    <input type="submit" value="Invia" name="submit">
</form></p>
           
        </p>
    </div>
</div>

</body>
</html> 
ok grazie, e ora?
 

RE: Modifica Upload System

#9
Nella seconda parte del php copiata devi cambiare:
Codice PHP:
$_FILES["fileToUpload"

con:
Codice PHP:
$_FILES["jsonToUpload"

Dopo dovrebbe funzionare, altrimenti dammi l'errore
Citazione:Noi non possiamo aiutare tutti, ma tutti possono aiutare qualcuno
 

RE: Modifica Upload System

#10
Codice:
<?php
session_start();

require_once('../lib/Users.class.php');
$login = New Users;
$login->access_denied();
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <title>Upload</title>
    
    <link rel="stylesheet" href="http://necolas.github.com/normalize.css/2.0.1/normalize.css">
    <link rel="stylesheet" href="/threedice-on/css/style2.css">
    <link rel="shortcut icon" href="https://poke-world.net/threedice-on/favicon.ico" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
    <script src="js/jquery-scrolltofixed-min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function() {
              $('.nav').scrollToFixed();
        });
    </script>
</head>
<body>

<div class="wrapper">
    <div class="header">
        <?php if($login->is_logged()) : ?>
        <span class="reglog">Ciao <b><?php echo $login->get_username(); ?></b>!&nbsp;&nbsp;<span class="logr"><?php echo $login->get_link_logout(); ?></span></span>
        <?php else: ?>
        <span class="reglog"><p><b><a href="http://poke-world.net/threedice-on/login.php">Accedi</a></b> se hai un Account!</p><p><b><a href="http://poke-world.net/threedice-on/registrazione.php">Registrati</a></b> a 3Dice-on per accedere a tutti i nostri Servizi!</span></p>
        <?php endif; ?>
    </div>
    <div class="nav">
      <span class="navitem"><a href="http://poke-world.net/threedice-on/">Home</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/">Oneiroi</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/news.php">Notizie</a></span>&nbsp;
     <?php if($login->is_logged()) : ?><span class="navitem2"><a href="http://poke-world.net/threedice-on/oneiroi/upload.php">Upload</a></span>&nbsp;<?php endif; ?>
     <span class="navitem"><a href="http://poke-world.net/threedice-on/oneiroi/supporto.php">Supporto</a></span>&nbsp;
     <span class="navitem"><a href="http://poke-world.net/threedice-on/about-us.php">Chi Siamo</a></span>
    </div>
    <div class="content">
       <center><span class="title">Upload - Carica un Sogno!</span></center>
        <br>
        <p>
<p>Carica i tuoi Sogni: gli altri giocatori potranno viverli!</p><br>
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}

$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["jsonToUpload"] ["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    $check = getimagesize($_FILES["jsonToUpload"] ["tmp_name"]);
    if($check !== false) {
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["jsonToUpload"] ["size"] > 500000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    if (move_uploaded_file($_FILES["jsonToUpload"] ["tmp_name"], $target_file)) {
        echo "The file ". basename( $_FILES["jsonToUpload"] ["name"]). " has been uploaded.";
    } else {
        echo "Sorry, there was an error uploading your file.";
    }
}
?><br>
<p><form action="upload.php" method="post" enctype="multipart/form-data">
    
    Seleziona l'immagine da Inviare:
    <input type="file" name="fileToUpload" id="fileToUpload"><br><br>
    Seleziona il file .json da inviare:
    <input type="file" name="jsonToUpload" id="jsonToUpload"><br><br>
    
    <input type="submit" value="Invia" name="submit">
</form></p>
           
        </p>
    </div>
</div>

</body>
</html> 
non si dovrebbe selezionare che deve essere un .json?
 
  

Vai al forum:


Utenti in questa pagina: 1 Ospite(i)