[SOLVED] Cant upload more then 6 files?
Posted: Thu Mar 03, 2005 5:09 pm
Hello all,
I need help, here is the code i use to upload files :
I cant upload more then 6 files on my server. In my code i newer sad there was a 6 file limit...
I cant figure out the problem. If anyone can help i would apriciate it alot.
thx.
feyd | please use
I need help, here is the code i use to upload files :
Code: Select all
// SLIKE
$result_final = "";
$counter = 0;
// List of our known photo types
$known_photo_types = array(
'image/pjpeg' => 'jpg',
'image/jpeg' => 'jpg',
'image/bmp' => 'bmp',
'image/x-png' => 'png'
);
// GD Function List
$gd_function_suffix = array(
'image/pjpeg' => 'JPEG',
'image/jpeg' => 'JPEG',
'image/bmp' => 'WBMP',
'image/x-png' => 'PNG'
);
// Fetch the photo array
$photos_uploaded = $_FILESї'photo_filename'];
$a = 0;
// UPLOAD SLIKA !!!!
// initialization
while( $counter <= count($photos_uploaded) )
{
if($photos_uploadedї'size']ї$counter] > 0)
{
if(!array_key_exists($photos_uploadedї'type']ї$counter], $known_photo_types))
{
$result_final .= "File ".($counter+1)." is not a photo<br />";
}
else
{
mysql_query( "INSERT INTO susreti_slike (`photo_filename`,`ID`) VALUES('0','$zadnji_id')" );
$new_id = mysql_insert_id();
$filetype = $photos_uploadedї'type']ї$counter];
$extention = $known_photo_typesї$filetype];
$filename = $new_id.".".$extention;
mysql_query( "UPDATE susreti_slike SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );
// Store the orignal file
copy($photos_uploadedї'tmp_name']ї$counter], $images_dir2."/".$filename);
// Let's get the Thumbnail size
$size = GetImageSize( $images_dir2."/".$filename );
if($sizeї0] > $sizeї1])
{
$thumbnail_width = 150;
$thumbnail_height = (int)(150 * $sizeї1] / $sizeї0]);
}
else
{
$thumbnail_width = (int)(150 * $sizeї0] / $sizeї1]);
$thumbnail_height = 150;
}
// Build Thumbnail with GD 2.x.x, you can use the other described methods too
$function_suffix = $gd_function_suffixї$filetype];
$function_to_read = 'ImageCreateFrom' . $function_suffix;
$function_to_write = 'Image' . $function_suffix;
// Read the source file
$source_handle = $function_to_read($images_dir2 . '/' . $filename);
if ($source_handle) {
// Let's create a blank image for the thumbnail
$destination_handle =
ImageCreateTrueColor($thumbnail_width, $thumbnail_height);
// Now we resize it
ImageCopyResampled($destination_handle, $source_handle,0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $sizeї0], $sizeї1]);
}
// Let's save the thumbnail
$function_to_write($destination_handle, $images_dir2 . '/tb_' . $filename);
ImageDestroy($destination_handle );
//
$result_final .= "<img src='".$images_dir2. "/tb_".$filename."' /> File ".($counter+1)." Added<br />";
}
}
$counter++;
}
// ENDI cant figure out the problem. If anyone can help i would apriciate it alot.
thx.
feyd | please use
Code: Select all
tags while theCode: Select all
tags are offline![/color]