1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

File Management Help.

Discussion in 'PHP' started by exaro, Aug 11, 2005.

  1. #1
    I'm looking to work with some files online using PHP. What I need to do is....

    1. Copy files of the same extension from one directory
    2. Split them into individual folders based on the file name.
    3. Add a .htm to each folder based on the copied file name.
    4. Be able to define what goes into the .htm you create.

    I don't expect anyone to whip up the code but any hints or tips would help.

    Thanks,

    Sean
    SEMrush
     
    exaro, Aug 11, 2005 IP
    SEMrush
  2. mck9235

    mck9235 Peon

    Messages:
    42
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Wow, this sounds complicated. I'll try to help as much as I can. :)
    To get an extension you could use substr()
    
    $file = $_FILES['file']['name'];
    //Grab the last four chars
    $ext = substr($file, -4, 4);
    //Not positive if this is right
    $ext2 = $_FILES['file']['type'];
    
    PHP:
    Do move certain files to a directory:
    
    if($ext = "Your extension...")
    {
    copy($_FILES['file']['tmp_name'], "/folder/". $_FILES['file']['name']);
    }
    
    PHP:
    I'm rather stuck with the rest. :(
    Good luck!
     
    mck9235, Aug 12, 2005 IP