WIN-IIS File Upload error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, All,
I tried to implement the file upload on a WEB server and run into the issue.
1.Test case 1.
WinXp, IIS, localhost - no problems.

2. Test case 2, Win2000, IIS, remote PC.
The error log, print_r $_FILES, and source follow below. I saw some notes
about the sharing. I tried to set tmp and Doc dir as Web shares - that
didn't work.

Thanks in advance.

====================================================================
Warning: move_uploaded_file(D:\INETPUB\WWWROOT\SCS\Documents\Club 977
HI.pls): failed to open stream: Permission denied in
d:\inetpub\wwwroot\scs\upload3.php on line 42

Warning: move_uploaded_file(): Unable to move
'D:\Inetpub\php\Temp\php25.tmp' to 'D:\INETPUB\WWWROOT\SCS\Documents\Club
977 HI.pls' in d:\inetpub\wwwroot\scs\upload3.php on line 42
============================================================================
==============
Array ( [myfile] => Array ( [name] => Club 977 HI.pls [type] => audio/scpls
[tmp_name] => D:\Inetpub\php\Temp\php25.tmp [error] => 0 [size] => 420 ) )
============================================================================
=========
if(isset($_FILES["myfile"]) and $_FILES["myfile"]["name"] != ''):
            //my file parameters
            $myfile = $_FILES["myfile"]["tmp_name"];
            $myfile_name = $_FILES["myfile"]["name"];
            $myfile_size = $_FILES["myfile"]["size"];
            $myfile_type = $_FILES["myfile"]["type"];
            $error_flag  = $_FILES["myfile"]["error"];
            $local_dir   = stripslashes($_POST['TARGET_DIR']);
            //$local_dir   = $_POST['TARGET_DIR'];
            $local_file  = $local_dir.basename($myfile_name);
            $can_move    = True;
            $response    = 'Ok';
            $info        = '';
            $info1       = '';
            $info2       = '';
            $info3       = '';

            // no error
            if($error_flag == 0):
               if ( file_exists($local_file) ):
                  if ( unlink($local_file)):
                     $info2 = "File Old file deleted";
                  else:
                     $info2 = 'Can not delete existing file';
                     $can_move = False;
                     $error_flag = 1;
                  endif;
               endif;
               if ( $can_move ):
============================================
                  if (move_uploaded_file($myfile, $local_file)):
=========================================
                     $info1 = 'File '.$local_file.' saved.';
                     $response  = 'OK';
                  else:
                     $info1 = 'File '.$local_file.' not saved.';
                     $info2 = 'Can not move '.$myfile.' to '.$local_file;
                     $response  = 'ERROR';
                     $error_flag = 1;
                  endif;
               else:
                  $info1 = 'File '.$local_file.' not saved.';
                  $response  = 'ERROR';
                  $error_flag = 1;
               endif;
            else:
               $info1 = 'File transfer error.';
               $response  = 'ERROR';
            endif;
            if ( $error_flag==0):
               $info='File upload successful';
            else:
               $info='File upload error';
               if ( $debug_mode):
                  print_r($_FILES);
               endif;
            endif;
-- 
Best regards,
Vladimir
---
mailto: vladimir.iahnenco@scancode.com

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux