Jump to content


http file uploads...

  • Please log in to reply
1 reply to this topic

#1 Chips

  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 05 July 2006 - 01:19 PM

The code is near identical to that of php.net's example... and it WORKS under linux/apache servers. However, I am trying to get the darned thing working upon WINDOWS IIS instead, which is giving problems. So it works on one platform, but not on another. Essentially the question is, does anyone know why? Sessions can be written to the local temp folder of the windows server, so I would have assumed that it's okay to upload files to that location as well (only admins can upload files, and at this moment-  security isn't an issue, tis a local server for local people... no strangers on here!).

<table width="100%" class="padded">
      <tr height="140">
        <td align="center">
          <form enctype="multipart/form-data" action="uploader.php" method="POST">
          <input type="hidden" name="MAX_FILE_SIZE" value="11111111" />
          <table border="0" cellpadding="0" cellspacing="0">
                Choose a file to upload:
              <td rowspan="2"> 
              <input name="userfile" type="file" />
              <td><span class="small">(max filesize is 1111111)</span>
                <td colspan="2" align="center">
                    <input type="submit" value="submit" name="submit"/>

// Where the file is going to be placed
$target_path = '';

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename($_FILES['userfile']['name']);
echo $target_path;
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['userfile']['name']).
    " has been uploaded";
} else{
    echo $_FILES['userfile']['error'] ." - error uploading the file, please try again!";

Any input or suggestions would be much appreciated.

#2 DaveLinger

  • Members
  • PipPipPip
  • Advanced Member
  • 268 posts
  • LocationWV, USA

Posted 05 July 2006 - 01:25 PM

I believe for the path under windows you have to include the full thing, including drive name... like mine was "E:/something/something/something/users/d/l/i/n/g/e/r/www/upload/"
dave at linger dot com

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users