I've tried googling, but, probably, I'm looking for something wrong...
So, I have a form for uploading images, it submits to the same file that renders it. In IE it works ok, but in Mozilla, instead of reloading the page containing the form it shows the white screen with the name of the php file being called...
Here's the code I use to upload images, may be it causes problems...
Code: Select all
$is_upload = false;
if (isset($_FILES['uploadedfile']['name'])) {
$target_path = 'uploads/';
$preview_path = 'previews/';
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$preview_path = $preview_path . basename( $_FILES['uploadedfile']['name']);
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
//-------------------------------------
header('Content-type: image/jpeg') ;
list($width, $height) = getimagesize($target_path) ;
$modwidth = 90;
$modheight = $height * (90 / $width);
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($target_path) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $preview_path, 100) ;
$is_upload = true;
//----------------
}
}Code: Select all
function output_success () {
global $is_upload;
if ($is_upload) {
include ('manage_uploads.php'); // this file renders the form for uploading / removing images
}
}Code: Select all
<form name="doc" enctype="multipart/form-data" action="db_admin.php" method="POST"><input type="hidden" name="MAX_FILE_SIZE" value="5242880" />Choose a file to upload: <input name="uploadedfile" type="file" /><br />Max file size: 5Mb<br /><input type="submit" value="Upload File" /></form>