PC Nerd Posted December 31, 2008 Share Posted December 31, 2008 Hi, Im trying to upload an excel spreadsheet and rename it to file{timestamp}.xls. At the moment I'm getting a Permisison Denied error from move_uploaded_file( and its to a folder that is 777 permissions). Thanks <?php else if(isset($_GET['checkin'])) { if (($_FILES["file"]["type"] == "application/octet-stream" || $_FILES["file"]["type"] == "application/vnd.ms-excel") && $_FILES["file"]["size"] < 2000000) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if(is_uploaded_file($_FILES["file"]["tmp_name"])) { echo $_FILES["file"]["name"]; $newfile = make_directory(getcwd()).basename(str_replace("&&&", time(), $basename)); echo "upload file: [".$newfile."]"; // usr DIRECTORY_SEPERATOR instead of make_directory(); if(@move_uploaded_file($_FILES["file"]["tmp_name"], $newfile)) { //rename($_FILES['file']['name'], str_replace("&&&", time(), $basename)); $currentlock = loadcurrentlockdata(); setlock(UNLOCKED); setcurrentlockdata(NULL); writelog("IN"."|".$currentlock[0]."|".time()."\n"); } else { echo "Failed to upload the file. Please try again"; } } else { echo "Checkin failed."; } } } else { echo "Invalid file. Either you have uploaded the wrong file, or it is too big. [".$_FILES["file"]["type"]."][".$_FILES["file"]["size"]."]"; } }?> Link to comment https://forums.phpfreaks.com/topic/138960-uploading-xls-with-rename/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.