Salve, ho scritto questo mini codice:
e il suo test php è questo:
non da nessun errore ma non carica nulla. Avete idea come mai ? uso la libreria dropzone.js:
http://www.dropzonejs.com/
Mi potete dire come mai?
Grazie mille e buona settimana.
Codice:
<!DOCTYPE html>
<html>
<head>
<title>PHP - Multiple upload using dropzone.js</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" >
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.4.0/dropzone.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.4.0/dropzone.js" charset="utf-8"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<h2>PHP - Multiple upload using dropzone.js</h2>
<form action="upload.php" enctype="multipart/form-data" class="dropzone" id="image-upload">
<div>
<h3>Upload Multiple By Click On Box</h3>
</div>
</form>
</div>
</div>
</div>
<script type="text/javascript">
Dropzone.options.imageUpload = {
maxFilesize:100,
uploadMultiple: true,
parallelUploads: 1,
acceptedFiles: ".jpeg,.jpg,.png,.gif,.zip"
};
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.1/umd/popper.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>
e il suo test php è questo:
PHP:
<?php
// Check for errors
if($_FILES['file']['error'] > 0){
die('An error ocurred when uploading.');
}
// Check if the file exists
if(file_exists('uploads/' . $_FILES['file']['name'])){
die('File with that name already exists.');
}
// Upload file
if(!move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' . $_FILES['file']['name'])){
die('Error uploading file - check destination is writeable.');
}
die('File uploaded successfully.');
non da nessun errore ma non carica nulla. Avete idea come mai ? uso la libreria dropzone.js:
http://www.dropzonejs.com/
Mi potete dire come mai?
Grazie mille e buona settimana.