Jump to content

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?".

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.