[+] EDITØR MODE [+]
htdocs
>
public
>
www
>
PHP_script
>
upload.php
Edit File: upload.php
<?php $link = mysqli_connect("hostingmysql323.register.it", "gregorio", "fontana2015", "fontanaarchitetti"); // Check connection if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // A list of permitted file extensions $allowed = array('png', 'jpg', 'gif'); 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 (!file_exists('../upload/'.$_POST["subf"].'/'.$_POST["gruppo"])) { mkdir('../upload/'.$_POST["subf"].'/'.$_POST["gruppo"], 0777, true); } $cat = mysqli_real_escape_string($link, $_POST['subf']); $id_gal = mysqli_real_escape_string($link, $_POST['gruppo']); $filename = mysqli_real_escape_string($link, $_FILES['upl']['name']); if(move_uploaded_file($_FILES['upl']['tmp_name'], '../upload/'.$_POST["subf"].'/'.$_POST["gruppo"].'/'.$_FILES['upl']['name'])){ $sql = "INSERT INTO gallery (cat, id_gal, path) VALUES ('$cat', '$id_gal', '$filename')"; if(mysqli_query($link, $sql)){ echo '{"status":"success"}'; } echo '{"status":"success"}'; exit; } } if($_POST['submitM']) { header('location:../gallery_editor.php?subf='.$_POST["subf"].'&id_gal='.$_POST["gruppo"].''); } if($_POST['submitD']) { header('location:../gallery_delete.php?subf='.$_POST["subf"].'&id_gal='.$_POST["gruppo"].''); } if($_POST['submitV']) { header('location:../gallery_video.php?subf='.$_POST["subf"].'&id_gal='.$_POST["gruppo"].''); } echo '{"status":"error"}'; exit;
Method:
fopen()
file_put_contents()
stream_context_create()
Simpan
Rename:
Rename