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++;
}
}
?>

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.