Jump to content

[SOLVED] Uploading image


ccrevcypsys

Recommended Posts

Someone let me know why this wont write to the database?

	if(is_array($_FILES['imageName'])){
	$date_str=date('Ymdhis');
	$imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['imageName']['name']));
$imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_POST['imageName']));
if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){
	copy($_FILES['imageName']['tmp_name'],"images/uploads/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['imageName']['name'])));
	if(is_array($_FILES['imageName_thumb'])){
		copy($_FILES['imageName_thumb']['tmp_name'],"images/uploads/thumbs".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalSample']['name'])));
                	$record["image"] = $db->mySQLSafe("images/uploads/thumbs".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['imageName']['name'])));
	}}
}

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

What errors are you getting, if any?  Is part of the script executing properly and only the DB part failing?  Is the file uploading at all?  What are you trying to insert into the DB?  The file, or the file's location?  What is the field type that you are inserting into?  If you are inserting the image, it has to be BLOB, other wise a character type.

 

You need to provide us more information than "Why isn't it working?".

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.