Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Image
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2011-01-04 12:47:02
How can i make that people could only upload one image and not 2

Heres the code:

	//upload images

$maxfilesize = 512000; // 500kb



$allowed_types = array(

"image/gif" => "gif",

"image/pjpeg" => "jpg",

"image/jpeg" => "jpg",

"image/jpg" => "jpg",

"image/png" => "png"

);



for ($x=0; $x < 2; $x++) {

if (!($_FILES[image.$x]['name'] == "")) {

$y = $x + 1;



if (!array_key_exists($_FILES[image.$x]['type'], $allowed_types))

show_error_msg("Error","Invalid file type! Image $y",1);



if (!preg_match('/^(.+)\.(jpg|gif|png)$/si', $_FILES[image.$x]['name']))

show_error_msg("Invalid image", "This file TYPE is not image!",1);



if ($_FILES[image.$x]['size'] > $maxfilesize)

show_error_msg("Error","Invalid file size! Image $y - Must be less than 500kb",1);



$uploaddir = "".$site_config["torrent_dir"]."/images/";

 

$ifile = $_FILES[image.$x]['tmp_name'];

 

$ret = mysql_query("SHOW TABLE STATUS LIKE 'torrents'");

$row = mysql_fetch_array($ret);

$next_id = $row['Auto_increment'];



$ifilename = $next_id . $x . substr($_FILES[image.$x]['name'], strlen($_FILES[image.$x]['name'])-4, 4);



$copy = copy($ifile, $uploaddir.$ifilename);



if (!$copy)

show_error_msg("Error","Error occured uploading image! - Image $y",1);



$inames[] = $ifilename;



}



}

//end upload images
Unknown User
2011-01-10 20:19:21
please post this in the technical support part or you might find an answer to your question by searching. i will delete this post in a day or two because it is in the wrong section.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728