Help with a program the uploads files using php

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

gbaspman
New php-forum User
New php-forum User
Posts: 1
Joined: Tue Oct 02, 2012 3:54 pm

Help with a program the uploads files using php

Postby gbaspman » Tue Oct 02, 2012 4:02 pm

I have a program that, records daily logs, and can upload them to a remote server. It supports php uploading via webform and post methods. I am currently hosting a website that supports upload via php, and it is functional, but i am unable to have the program successfully upload the log to the site. The program requests the link to the upload script. If someone could help me fix this, it would be greatly appreciated.
My script is as follows:

Code: Select all

<?php


$upl_folder = 'uploads/'; // Relative path where to put log file

if (is_uploaded_file($_FILES['uploadedfile']['tmp_name'])) {

   $uploadfile = $upl_folder . basename($_FILES['uploadedfile']['name']);
   
   echo "File ". $_FILES['uploadedfile']['name'] ." uploaded successfully. Now trying to move it...\n";
   
   if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $uploadfile)) {
          echo "File was moved successfully. All OK.\n";
   }
   else {
      // something didn't work
      // debug:
        print_r($_FILES);
   }
}
else {
  echo "Failed!!!";
  }
?>


I am able to manually go to the site, and upload the file using an html/php upload form, but the program cant upload it.

Thanks.

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest

cron