Dupa upload poza pagina revine sus in "top"
Scris: Sâm Apr 06, 2019
Dupa ce am uploadat poza pagina revine sus , care ar fi solutia sa nu mai revina sus , sa ramana exact acolo unde sa exectuat actiunea ?
am incercat cu:
- functioneaza la refresh de pagina, dar folosind formul nare nici un efect.
am incercat cu:
Cod: Selectaţi tot
<script> location.hash = (location.hash) ? location.hash : " "; </script>
Cod: Selectaţi tot
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" enctype="multipart/form-data" id="new_image" class="fileUploadxd">
<input name="new_image" id="new_image" size="10" type="file" class="uniFormsd" />
<button name="comtec" type="submit" class="submitButtonls" id="new_i" onclick="move()">Incarca</button>
</form>
<?php
if(isset($_POST['comtec'])){
if (isset ($_FILES['new_image'])){
$file_name ="IMG".date('dmYHis'); //se anuleaza
$source = $_FILES['new_image']['tmp_name'];
//////insert db
$conn = new mysqli($host, $utilizator, $parola, $numebd);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql_insert = "INSERT INTO db_foto (poze_in_site)
VALUES ('$imagepath')";
//printf("Last inserted record has id %d\n", mysql_insert_id());
if ($conn->query($sql_insert) === TRUE) {
echo'<meta http-equiv="Refresh" content="1;url='.$_SERVER['PHP_SELF'].'">';
} else {
//echo "Error: " . $sql_insert . "<br>" . $conn->error;
}
$conn->close();
//...