Refresh
Ik wil de volgende refresh maken maar hij refreshed alleen maar naar :
http://www.eensite.nl?
Ik mis de overige gegevens van de pagina, weet iemand wat ik fout doe?
http://www.eensite.nl?
Ik mis de overige gegevens van de pagina, weet iemand wat ik fout doe?
$_SERVER['QUERY_STRING'] is leeg? Dump je $_SERVER-variabele eens (var_dump()).
Die dump geeft het volgende :
string(45) "nieuwsid=76&mw=750&tw=100&th=120&soort=avatar"
string(45) "nieuwsid=76&mw=750&tw=100&th=120&soort=avatar"
Dan moet hij het gewoon doen.
Ja dat dacht ik ook.
Heb hier nog een stuk van de code, misschien geeft het zo meer duidelijkheid?
Heb hier nog een stuk van de code, misschien geeft het zo meer duidelijkheid?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
if (isset($_POST["upload"])) {
//Get the file information
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
$filename = basename($_FILES['image']['name']);
$file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
//Only process if the file is a JPG, PNG or GIF and below the allowed limit
if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) {
foreach ($allowed_image_types as $mime_type => $ext) {
//loop through the specified image types and if they match the extension then break out
//everything is ok so go and check file size
if($file_ext==$ext && $userfile_type==$mime_type){
$error = "";
break;
}else{
$error = "Alleen <strong>".$image_ext."</strong> afbeeldingen zijn geaccepteerd.<br />";
}
}
//check if the file size is above the allowed limit
if ($userfile_size > ($max_file*1048576)) {
$error.= "Afbeeldingen moeten kleiner dan ".$max_file."MB zijn.";
}
}else{
$error= "Selecteer een afbeelding.";
}
//Everything is ok, so we can upload the image.
if (strlen($error)==0){
if (isset($_FILES['image']['name'])){
//this file could now has an unknown file extension (we hope it's one of the ones set above!)
$large_image_location = $large_image_location.".".$file_ext;
$thumb_image_location = $thumb_image_location.".".$file_ext;
//put the file ext in the session so we know what file to look for once its uploaded
$_SESSION['user_file_ext']=".".$file_ext;
move_uploaded_file($userfile_tmp, $large_image_location);
chmod($large_image_location, 0777);
$width = getWidth($large_image_location);
$height = getHeight($large_image_location);
//Scale the image if it is greater than the width set above
if ($width > $max_width){
$scale = $max_width/$width;
$uploaded = resizeImage($large_image_location,$width,$height,$scale);
}else{
$scale = 1;
$uploaded = resizeImage($large_image_location,$width,$height,$scale);
}
//Delete the thumbnail file so the user can create a new one
if (file_exists($thumb_image_location)) {
unlink($thumb_image_location);
}
}
//Refresh the page to show the new uploaded image
header("location:".$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"]);
exit();
}
}
?>
if (isset($_POST["upload"])) {
//Get the file information
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$userfile_type = $_FILES['image']['type'];
$filename = basename($_FILES['image']['name']);
$file_ext = strtolower(substr($filename, strrpos($filename, '.') + 1));
//Only process if the file is a JPG, PNG or GIF and below the allowed limit
if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) {
foreach ($allowed_image_types as $mime_type => $ext) {
//loop through the specified image types and if they match the extension then break out
//everything is ok so go and check file size
if($file_ext==$ext && $userfile_type==$mime_type){
$error = "";
break;
}else{
$error = "Alleen <strong>".$image_ext."</strong> afbeeldingen zijn geaccepteerd.<br />";
}
}
//check if the file size is above the allowed limit
if ($userfile_size > ($max_file*1048576)) {
$error.= "Afbeeldingen moeten kleiner dan ".$max_file."MB zijn.";
}
}else{
$error= "Selecteer een afbeelding.";
}
//Everything is ok, so we can upload the image.
if (strlen($error)==0){
if (isset($_FILES['image']['name'])){
//this file could now has an unknown file extension (we hope it's one of the ones set above!)
$large_image_location = $large_image_location.".".$file_ext;
$thumb_image_location = $thumb_image_location.".".$file_ext;
//put the file ext in the session so we know what file to look for once its uploaded
$_SESSION['user_file_ext']=".".$file_ext;
move_uploaded_file($userfile_tmp, $large_image_location);
chmod($large_image_location, 0777);
$width = getWidth($large_image_location);
$height = getHeight($large_image_location);
//Scale the image if it is greater than the width set above
if ($width > $max_width){
$scale = $max_width/$width;
$uploaded = resizeImage($large_image_location,$width,$height,$scale);
}else{
$scale = 1;
$uploaded = resizeImage($large_image_location,$width,$height,$scale);
}
//Delete the thumbnail file so the user can create a new one
if (file_exists($thumb_image_location)) {
unlink($thumb_image_location);
}
}
//Refresh the page to show the new uploaded image
header("location:".$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"]);
exit();
}
}
?>
Gewijzigd op 01/01/1970 01:00:00 door Martijn Roverts
Heeft er niks mee te maken. Het gaat om die regel 62, en dat behoort bij de $_SERVER-array. Hij moet het gewoon doen zo.
Doe dit eens:
Wat geeft dat?
Doe dit eens:
Wat geeft dat?
string(81) "/data/functies/upload_crop_v1.2.php?nieuwsid=76&mw=750&tw=100&th=120&soort=avatar"
Niks geks dus...rara politiepet.
Niks geks dus...rara politiepet.
Heel gek. Heb je ook geen output voor de header()?
Staat er nergens anders in je code een header, die al eerder afvangt?
Geen output voor de header?
Heb je een 404 verwerking die een niet bestaande pagina's naar de begin pagina's linkt?
Gewijzigd op 01/01/1970 01:00:00 door Pieter van Linschoten
Had de action in de form nog op $_SERVER['PHP_SELF'] staan. Logisch achteraf.
Thanx voor de ruggespraak!
Thanx voor de ruggespraak!




