dude88
04-25-2006, 03:30 PM
Hi guys,Does anyone know how to join the 2 uploaded files together under the variable $FileName?
$FileName=$UploadDir.$_FILES['uploadedfile1']['name'] $UploadDir.$_FILES['uploadedfile2']['name'];
not entirely sure what you are asking since your pseudo code suggest you wnat to merge the filenames..
// merge filenames
$FileName= $UploadDir.$_FILES['uploadedfile1']['name'].$UploadDir.$_FILES['uploadedfile2']['name'];
but maybe you meant you want to join the files together..
// merge file
$FileName= file_get_contents($_FILES['uploadedfile1']['tmp_name']).file_get_contents($_FILES['uploadedfile2']['tmp_name']);
dude88
04-26-2006, 06:11 AM
I think it should work but i have another error with the array stuff.
Warning: Wrong parameter count for in_array() in test.php on line 8
$FileTypes=array("image/jpg", "image/gif", "image/jpeg", "image/pjpeg");
// Check to ensure the uploaded file is of correct type
if (in_array($_FILES['uploadfile1']['type'],$FileTypes and $_FILES['uploadfile2']['type'],$FileTypes))
if (in_array($_FILES['uploadfile1']['type'],$FileTypes) && in_array($_FILES['uploadfile2']['type'],$FileTypes))
you should also be checking the file extension.. a mime type can be easily forged.
dude88
04-27-2006, 11:21 AM
i see.how do i check for extension?