aeroswat Posted June 2, 2010 Share Posted June 2, 2010 Here's the code if (($_FILES["ufile"]["type"] == "text/x-sql") && ($_FILES["ufile"]["size"] < 5000000)) { if ($_FILES["ufile"]["error"] > 0) { echo "Return Code: " . $_FILES["ufile"]["error"] . "<br />"; }else { echo "Upload: " . $_FILES["ufile"]["name"] . "<br />"; echo "Type: " . $_FILES["ufile"]["type"] . "<br />"; echo "Size: " . ($_FILES["ufile"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["ufile"]["tmp_name"] . "<br />"; if (file_exists("../backups/" . $_FILES["ufile"]["name"])) { echo $_FILES["ufile"]["name"] . " already exists. "; }else { move_uploaded_file($_FILES["ufile"]["tmp_name"], "../backups/" . $_FILES["ufile"]["name"]); echo "Stored in: " . "../../backups/" . $_FILES["ufile"]["name"]; } } }else { echo $_FILES["ufile"]["type"] . ' ' . $_FILES["ufile"]["name"]; echo " is an invalid file"; } I have a upload file form that works with this and this code transfers the file to a permanent directory that is 2 levels above the file that is invoking the script. The first time I ran it with one of my files it gave me this as an output Upload: Vincent_orders_02_02_2010_04-49PM.sql Type: text/x-sql Size: 675.7578125 Kb Temp file: /tmp/phpUVSTze Stored in: ../../backups/Vincent_orders_02_02_2010_04-49PM.sql The next time I ran it showed me this Upload: Vincent_orders_02_02_2010_04-49PM.sql Type: text/x-sql Size: 675.7578125 Kb Temp file: /tmp/php6fGPyv Vincent_orders_02_02_2010_04-49PM.sql already exists. Woohoo it works right? Well I go into the backups folder and there are absolutely no files in there The directory structure is like this Top Level -> Backups (This is where I'm trying to transfer the uploaded file) Top Level -> Public_html -> maint (This is where the php file is located) Can anyone see anything obvious? EDIT: I should also mention that backups has (777) attributes and that when move_uploaded_files is given a directory that doesn't exist it throws an error stating that. Link to comment https://forums.phpfreaks.com/topic/203629-code-looks-like-its-working-but-not-producing-the-expected-results/ Share on other sites More sharing options...
aeroswat Posted June 2, 2010 Author Share Posted June 2, 2010 FileZilla is just wanting to error It took like 20 minutes for it to show the changes in FileZilla ftp. Was no error. Thanks Link to comment https://forums.phpfreaks.com/topic/203629-code-looks-like-its-working-but-not-producing-the-expected-results/#findComment-1066625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.