Keith.Welch Posted September 3, 2009 Share Posted September 3, 2009 I use this script to allow uploading of small text files from an Adobe Flex front end. For a change, it works fine in IE7 but not in any other other browser. I get no error message, but the page just hangs, and a 0 kb file is created in my target directory. OS: Vista Server: Apache authentication: .htaccess the uploads are stored in a directory outside my web root. That folder permission is 700, although it doesn't seem to affect the problem the script: <?php error_reporting(E_ALL); $uploadFolder = "/ip/libcasd/lhr/uploads/"; $logFile = fopen($uploadFolder."logfile.txt", 'a'); if (isset($_FILES['Filedata']['name']) && (isset($_ENV["REMOTE_USER"]))){ $tempFile = $_FILES['Filedata']['tmp_name']; $suffix = substr($_FILES['Filedata']['name'], -4, 4); $fileName = $_ENV["REMOTE_USER"].$suffix; $fileSize = $_FILES['Filedata']['size']; $dateStamp = date("F j, Y, g:i a"); if(!preg_match("/(\.txt)$/i", $fileName)) { fwrite($logFile, $dateStamp." Invalid file type ".$fileName." ".$fileSize."\n"); fclose($logFile); die ("Server: Upload failed: Invalid file type."); } if ($fileSize > 10000) { fwrite($logFile, $dateStamp." File is too large ".$fileName." ".$fileSize."\n"); fclose($logFile); die ("Server: Upload failed: max. file size = 10KB"); } elseif ($fileSize == 0) { fwrite($logFile, $dateStamp." Empty file ".$fileName." ".$fileSize."\n"); fclose($logFile); die ("Server: Upload failed: Empty file"); } else { move_uploaded_file($tempFile, "$uploadFolder".$fileName); fwrite($logFile, $dateStamp." Successful upload ".$fileName." ".$fileSize."\n"); die("Server: Upload successful."); } } fclose($logFile); ?> Link to comment https://forums.phpfreaks.com/topic/173011-upload-script-works-with-ie7-but-not-with-ff3-safari-or-chrome-2/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 3, 2009 Share Posted September 3, 2009 Your code is dependent on $_ENV["REMOTE_USER"] to do anything. Have you checked what it actually contains? Link to comment https://forums.phpfreaks.com/topic/173011-upload-script-works-with-ie7-but-not-with-ff3-safari-or-chrome-2/#findComment-911842 Share on other sites More sharing options...
Keith.Welch Posted September 3, 2009 Author Share Posted September 3, 2009 Your code is dependent on $_ENV["REMOTE_USER"] to do anything. Have you checked what it actually contains? In this case, it contains the username of the .htaccess authenticated user. But it is a point - I'll check that variable content. Thanks Link to comment https://forums.phpfreaks.com/topic/173011-upload-script-works-with-ie7-but-not-with-ff3-safari-or-chrome-2/#findComment-911854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.