hi guys.. how are you all??
ok, i need you help to make this happen...
i want to create a system that allow people to upload big files and you all know that php time limit is 5 minutes and size limit is 5 mb max.. in case we increased the size limit, the time limit will affect us right??
so how can i create a system that upload more than 5 mb and ignore the time limit??
this is a normal uploading script that i made for the system but it doesnt really do required job... how can i improve it to be able to upload more in more than 5 minutes...
<?php
$uploaddir = '/uploads/images/all/';
$ref = $_SERVER['HTTP_REFERER'];
if(!isset($_COOKIE['elb'])){ header("location: $ref");} else{
$elb = $_COOKIE['elb'];
include "engine/db/main.php";
$db = new db();
$db->connect();
$db->select("pics"); // my own db class
$elb = mysql_real_escape_string($_COOKIE['elb']);
$uid = mysql_real_escape_string($_COOKIE['ln']);
$q = mysql_query("SELECT * FROM elb WHERE md5id='$elb' AND uid = '$uid'")or die("there is no such elb");
if(mysql_num_rows($q) == 0){
$time = date()+60*60;
setcookie("error", "Not Valid Elbum. please try again", $time);
header("location: 404.php");
}
// now lets start doing the real job of uploading
$ran = rand();
$file = $uploaddir . $ran . basename($_FILES['uploadfile']['name']);
$size=$_FILES['uploadfile']['size'];
if($size>5120000)
{
echo "error file size > 500 MB";
unlink($_FILES['uploadfile']['tmp_name']);
exit;
}
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
echo "success";
// ignore this part, it is for resizing images
include("classes/resize-class.php");
// *** 1) Initialise / load images
$resizeObj = new resize($file);
$resizeObj2 = new resize($file);
$resizeObj3 = new resize($file);
$resizeObj4 = new resize($file);
// *** 2) Resize images (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(65, 65, 'exact');
$resizeObj2 -> resizeImage(500, 500, 'exact');
$resizeObj3 -> resizeImage(1000, 700, 'exact');
$resizeObj4 -> resizeImage(200, 200, 'exact');
$md5pic = md5($file);
// *** 3) Save images
$resizeObj -> saveImage('uploads/images/small/'.$file, 100);
$resizeObj2 -> saveImage('uploads/images/medium/'.$file, 100);
$resizeObj3 -> saveImage('uploads/images/big/'.$file, 100);
$resizeObj4 -> saveImage('uploads/images/profile/'.$file, 100);
$md5 = md5($pic);
$q = mysql_query("INSERT INTO `all`(id, owner, name, des, md5, gallery) VALUES ('', '$uid', '$file', '$des', '$md5', '$elb'");
} else {
echo "error ".$_FILES['uploadfile']['error']." -|-|- ".$_FILES['uploadfile']['tmp_name']." %-%-% ".$file."($size)";
}
?>
any help will be highly appreciated !!!!