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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.