digitalgod Posted September 5, 2007 Share Posted September 5, 2007 hey guys, I'm trying to upload a file to higher directory but for some reason even though that directory exists I keep getting this error move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpNH2aX9' to '../../products/Untitled.jpg' I thought that it was because the server is full but it's not... the only time it actually works is if I upload in the same directory as the script... the script is located in sales/modules/base and the upload directory is in sales/products Any ideas why it's not working? //$uploaddir = "../../products/" if (move_uploaded_file($file_tmp, $uploaddir . $file_name)) { ... } Quote Link to comment https://forums.phpfreaks.com/topic/68124-solved-move_uploaded_file-problem/ Share on other sites More sharing options...
syntaxerror Posted September 5, 2007 Share Posted September 5, 2007 you said 'any' : check the directory permissions OS side presumably you're using Apache, check your config for directory permissions Quote Link to comment https://forums.phpfreaks.com/topic/68124-solved-move_uploaded_file-problem/#findComment-342523 Share on other sites More sharing options...
digitalgod Posted September 6, 2007 Author Share Posted September 6, 2007 well why would it work on the current directory but not another one? The current directory is 644 and the directory where I'm trying to move the image to is 777. Quote Link to comment https://forums.phpfreaks.com/topic/68124-solved-move_uploaded_file-problem/#findComment-342653 Share on other sites More sharing options...
teng84 Posted September 6, 2007 Share Posted September 6, 2007 try to include the real path maybe thats causing you a prob you can try this $_SERVER['DOCUMENT_ROOT']/folder/folder/.. and echo if the path is correct just for the sake of debugging Quote Link to comment https://forums.phpfreaks.com/topic/68124-solved-move_uploaded_file-problem/#findComment-342656 Share on other sites More sharing options...
digitalgod Posted September 7, 2007 Author Share Posted September 7, 2007 that worked perfectly, thanks! Any ideas why my way wasn't working? Quote Link to comment https://forums.phpfreaks.com/topic/68124-solved-move_uploaded_file-problem/#findComment-343824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.