need short script help for php 5

Discussion in 'PHP' started by mesmark, Jul 4, 2011.

  1. #1
    I have a site that's using this script to upload a picture to my server. My server recently made changes and upgrades and now it's not working. I'd really appreciate if you could take a look and tell me if there are any problems with regards to PHP5:

    <?php
    $uploaddir = "folder/";
    $ext="." .substr($HTTP_POST_FILES['Filedata']['name'],-3);
    do{
    $rnd=mt_rand();
    $uploadfile = $uploaddir . $rnd . $ext;
    }while(file_exists($uploadfile));
    move_uploaded_file($HTTP_POST_FILES['Filedata']['tmp_name'],$uploadfile);
    echo "http://www.mysite.com/directory/folder/$rnd$ext";
    exit();
    ?>
    Code (markup):
    Any help is greatly appreciated. Thanks in advance.
     
    Last edited: Jul 4, 2011
    mesmark, Jul 4, 2011 IP
  2. mesmark

    mesmark Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I got the help I needed. I just needed to change the $HTTP_POST_FILES instances to $_FILES

    Thanks anyway for taking a look.
     
    mesmark, Jul 4, 2011 IP