shadiadiph Posted February 18, 2009 Share Posted February 18, 2009 Hi I am having a problem moving a file using move_uploaded_file($fileatt, "../secure/admin/clients/$username"); the file path is outside the directory the file is in so I am using ../ as you usually would the file path exists but it keeps telling me it doesn't.?? the error is Warning: move_uploaded_file(../secure/admin/clients/johnny99/) [function.move-uploaded-file]: failed to open stream: Is a directory in /home Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/ Share on other sites More sharing options...
Adam Posted February 18, 2009 Share Posted February 18, 2009 the file path is outside the directory the file is in so I am using The directory the uploaded file is in, or the directory the script is running in? The destination directory must be relative to the directory you're running the script from, not where the file is saved. Adam Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765080 Share on other sites More sharing options...
shadiadiph Posted February 18, 2009 Author Share Posted February 18, 2009 the script is running in a directory called submit my diectories in the main htm folder are images submit secure script is running in the submit directory previously in this script I have already used mkdir("../secure/admin/clients/$username", 0700); I checked it has already made the directory ../secure/admin/clients/johnny99 etc Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765088 Share on other sites More sharing options...
shadiadiph Posted February 18, 2009 Author Share Posted February 18, 2009 sorry noticed one error I am now using move_uploaded_file($fileatt, "../secure/admin/clients/$username/$fileatt_name"); and am still getting a similar error Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phplVoz1r' to '../secure/admin/clients/johnny99/Forest Flowers.jpg' Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765092 Share on other sites More sharing options...
Adam Posted February 18, 2009 Share Posted February 18, 2009 Okay fair do's! What are you assigning $fileatt to? Adam Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765095 Share on other sites More sharing options...
Cal Posted February 18, 2009 Share Posted February 18, 2009 I'm not sure on this, but I don't think you can use a trailing slash in move_uploaded_file. Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765097 Share on other sites More sharing options...
shadiadiph Posted February 18, 2009 Author Share Posted February 18, 2009 $fileatt is a file i have just uploaded from a form solved it now anyway it is uploading i just put a ./ in fron of ../ don't know why this makes a difference so I now have ./../secure Quote Link to comment https://forums.phpfreaks.com/topic/145719-solved-moving-file-problem/#findComment-765109 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.