php help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Restola
    Certificated Cloud Buster
    • May 2001
    • 2230

    #1

    php help

    The following is code for a form that uploads a selected file. http://www.restola.com/help.txt

    If the form is in www.restola.com/upload

    it sends the file to www.restola.com/upload/files

    I want it to go to www.restola.com/images (or anywhere else, I just dont understand it)

    Thanks
    Last edited by Restola; 10-18-2004, 06:04 PM.

    AO Feedback / Ebay Feedback / AOPA / JeepForum.com / IPR
  • coopy18
    Registered User
    • Oct 2004
    • 21

    #2
    Okay, I am not a PHP programmer but I think you do something like this...

    instead of this line:
    copy($HTTP_POST_FILES['ChooseFile']['tmp_name'], "files/".$image_part);

    use this:
    copy($HTTP_POST_FILES['ChooseFile']['tmp_name'], "images/".$image_part);

    That would probably upload the file to www.restola.com/upload/images

    Also, I bet this:
    copy($HTTP_POST_FILES['ChooseFile']['tmp_name'], "http://www.restola.com/whereever/".$image_part);

    would upload it to


    As I said, I don't normally write code in PHP, but I bet this gets you close. FYI, make sure the folder has write permissions or it won't work.

    -coopy

    Comment

    • Kevmaster
      Owners Group Div: Director
      • Oct 2001
      • 5475

      #3
      yes, a very big part of this that i struggled with is the folder permissions....heres the script I use to upload a file to my server and do some other stuff...

      [PHP]
      if ( $fileName_size <= 250000) {
      if (checkStatus($username, $password) == true) {
      //this calls a function that checks my forum database to make sure the user is a member
      $destination = "$catagory/$fileName_name";
      //they sent me a catagory var that is a the name of a folder w/i the /gallery/ directory
      copy ("$fileName", "$destination");
      //this copies the file to the location in the gallery
      $to = "[email protected]";
      $subject = "IMAGE UPLOAD SUCCESSFUL";
      $msg = "The file named: $fileName_name has been uplaoded in the folder: $catagory by the user: $username";
      $msghead = "FROM: Brass Eagle Owners Group <[email protected]>";
      mail($to, $subject, $msg, $msghead);
      //error message
      }
      else {
      header("Location: http://www.beog.org/gallery/upload.php?name=true");
      //ireturns to uploadpage if not a member
      }
      }
      else {
      header("Location: http://www.beog.org/gallery/upload.php?type=true");
      //returns to upload page if fileis too big ornot a jpg or gif
      }

      Comment

      Working...