Jump to content

[SOLVED] image upload


ccrevcypsys

Recommended Posts

shouldnt this be working?

 

<?php
$record["image"] = $db->mySQLSafe($_POST['imageName']);
	if(is_array($_FILES['imageName'])){
	$date_str=date('Ymdhis');
	$imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['imageName']['name']));
if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){
	copy($_FILES['imageName']['tmp_name'],"images/uploads/".$date_str."_".str_replace(' ','_',$_FILES['imageName']['name'])) or die("| copy error |");
		$record["image"] = $db->mySQLSafe($date_str."_".$_FILES['imageName']['name']);
	copy($_FILES['imageName']['tmp_name'],"images/uploads/thumbs/thumb_".$date_str."_".str_replace(' ','_',$_FILES['imageName']['name'])) or die("| copy 2 Thumb error |");
	if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$date_str."_".$_FILES['imageName']['name'])){
		@chmod($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$date_str."_".$_FILES['imageName']['name'], 0775);
		unlink($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$date_str."_".$_FILES['imageName']['name']);
	}

	$thumb=new thumbnail("images/uploads/".$date_str."_".$_FILES['imageName']['name']);
	// see if we need to resize 
	if(($size[0] > $config['gdthumbSize']) OR ($size[1] > $config['gdthumbSize'])){
		$thumb->size_auto($config['gdthumbSize']);
	} else {
		$thumb->size_auto($size[0]);
	}
	$thumb->jpeg_quality($config['gdquality']);
$thumb->save("images/uploads/thumbs/thumb_".$date_str."_".$_FILES['imageName']['name']);		}
}
?>
...
<tr>
<td class="tdText" align="left" valign="top" width="25%">
<strong>
Image:
</strong>
  <br>
<!--(Optional and thumbnails will automatically be made IF the format chosen is compatible.)-->
</td>
<td valign="top">
<div id="selectedImage">
</div>
<div id="imageControls">
<table border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
    <td>
    	<input name="image" style="width: 200px;" class="submit" type="file" id="image" /></td>
  </tr>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
...

no errors it just doesnt upload anything

Link to comment
https://forums.phpfreaks.com/topic/67921-solved-image-upload/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.