Salve, ho scaricato uno script in PHP e lo sto modificando, le mie conoscenze sono scarse quindi abbiate pazienza
Funziona tutto correttamente, ma vorrei che una volta caricato il file mi spunti il link.
upload.php
Codice PHP:
<?php
// A list of permitted file extensions
$allowed = array('png', 'jpg', 'gif','zip','rar''mp3');
if(isset($_FILES['upl']) && $_FILES['upl']['error'] == 0){
$extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
if(!in_array(strtolower($extension), $allowed)){
echo '{"status":"error"}';
exit;
}
if(move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$_FILES['upl']['name'])){
echo '{"status":"success"}';
exit;
}
}
echo '{"status":"error"}';
exit;
?>
index.php
Codice PHP:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>DropMe - Carica i tuoi file</title>
<!-- Google web fonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700" rel='stylesheet' />
<!-- The main CSS file -->
<link href="assets/css/style.css" rel="stylesheet" />
</head>
<body>
<form id="upload" method="post" action="upload.php" enctype="multipart/form-data">
<div id="drop">
Trascina quì
<a>Seleziona</a>
<input type="file" name="upl" multiple />
</div>
<ul>
<!-- The file uploads will be shown here -->
</ul>
</form>
<footer>
<center><h2>Developed by <b>Angelo Laveglia</h2>
<div id="tzine-actions">
</div>
</footer>
<!-- JavaScript Includes -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="assets/js/jquery.knob.js"></script>
<!-- jQuery File Upload Dependencies -->
<script src="assets/js/jquery.ui.widget.js"></script>
<script src="assets/js/jquery.iframe-transport.js"></script>
<script src="assets/js/jquery.fileupload.js"></script>
<!-- Our main JS file -->
<script src="assets/js/script.js"></script>
</body>
</html>
Un aiutino?