Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help in joining 2 uploaded files

    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'];

  • #2
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not entirely sure what you are asking since your pseudo code suggest you wnat to merge the filenames..
    Code:
    // merge filenames
    $FileName= $UploadDir.$_FILES['uploadedfile1']['name'].$UploadDir.$_FILES['uploadedfile2']['name'];
    but maybe you meant you want to join the files together..
    Code:
    // merge file
    $FileName= file_get_contents($_FILES['uploadedfile1']['tmp_name']).file_get_contents($_FILES['uploadedfile2']['tmp_name']);

  • #3
    New Coder
    Join Date
    Apr 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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))

  • #4
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    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.

  • #5
    New Coder
    Join Date
    Apr 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i see.how do i check for extension?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •