Jump to content

[SOLVED] Image Upload Script is slow and not working.


cooldude832

Recommended Posts

I've had this script and its worked before and now its extremely slow if i upload images and then doesn't place them in the folder or give me the die message.

<?php
//Image Handelers here
// Your file name you are uploading
$i = 0;
$count = 0;
//Lets add some nubmers for safety
$random_digit = $_POST['random'];
$us = "_";
$pathto = "/files/".$random_digit.$us;
if ($_POST['newimages'] == "yes")
{
while ($i <= 3)
{	
if ($_FILES['imagefile'.$i]['type'] == "image/jpeg" || $_FILES['imagefile'.$i]['type'] == "image/jpg"
|| $_FILES['imagefile'.$i]['type'] == "image/pjpeg" || $_FILES['imagefile'.$i]['type'] == "image/pjpg")
	{
	$count++;
	$file_name = "";
	$file_name .= "temp.";
	$file_name .= str_replace(".jpg","",str_replace("/","",str_replace("image","",$_FILES['imagefile'.$i]['type'])));
	$ext = ".jpg";
	//Lets make a new name
	$new_file_name=$random_digit.$us.$count.$ext;
	//Lets Path it
	$path[$count]= "files/".$new_file_name;
	if(copy($_FILES['imagefile'.$i]['tmp_name'], $path[$count]))
	{}
	else
	{
	die("Copy error");
	}

}
$i++;
}
}
else
{
$i=0;
$count = 0;
while ($i <=3)
{
	if ($_POST['imgpath'.$i] != "")
	{
	$count++;
	$path[$count] = $_POST['imgpath'.$i];
	}
$i++;
}
}
?>

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.