Jump to content

image function not uploading correctly?


darkfreaks

Recommended Posts

sometimes it uploads sometimes it does not anyone see flaws?

 

<?php

if(!empty($_FILES['images']'name'][0]))
{
	while(list($key,$value) = each($_FILES['images']['name']))
	{
		if(!empty($value))
		{
			list($fname,$ext) = split("\.", $value);
			if ($ext == "jpg" || $ext == "gif" || $ext == "png") {
				$NewImageName = $t."_offer_".$value;
				copy($_FILES['images']['tmp_name'][$key], "re_images/".$NewImageName);

				$MyImages[] = $NewImageName;
			}
		}
	}

	if(!empty($MyImages))
	{
		$ImageStr = implode("|", $MyImages);
	}

}?>

Link to comment
Share on other sites

You could handle your errors so you know why it's not uploading

 

<?php
if(!empty($_FILES['images']'name'][0]))
{
	while(list($key,$value) = each($_FILES['images']['name']))
	{
		if(!empty($value))
		{
			list($fname,$ext) = split("\.", $value);
			if ($ext == "jpg" || $ext == "gif" || $ext == "png") {
				$NewImageName = $t."_offer_".$value;
				copy($_FILES['images']['tmp_name'][$key], "re_images/".$NewImageName);

				$MyImages[] = $NewImageName;
			}else{
				echo "Only jpg, gif and png";
			}
		}else{
			echo "Value is empty";
		}
	}

	if(!empty($MyImages))
	{
		$ImageStr = implode("|", $MyImages);
	}

}else{
	echo "File not posted";
}?>

 

Of course if your img has 11 mega px it's not gona upload lol

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.