madspof Posted January 13, 2008 Share Posted January 13, 2008 Hi everyone i am having this slight problem where i am completly stuck i am trying to copy a file to another location by using the copy function. The new location has a variable in it which is causing the problem if i just try and enter the variable into the path the variable is the same and if i try and escape the "" with ' ' i get the variable with the ' ' either side of it. What should i do Here you can see my problem: $file = "c:\Deskfun\users\orignal.jpg"; $newfile = "c:\Deskfun\users\$username\pictures\default.jpg"; copy($file, $newfile); Error given = Warning: copy(c:\Deskfun\users$username\pictures\default.jpg) [function.copy]: failed to open stream: No such file or directory in C:\Deskfun\register.php on line 146 $file = "c:\Deskfun\users\orignal.jpg"; $newfile = "c:\Deskfun\users\'$username'\pictures\default.jpg"; copy($file, $newfile); Error given = Warning: copy(c:\Deskfun\users\'test1'\pictures\default.jpg) [function.copy]: failed to open stream: No such file or directory in C:\Deskfun\register.php on line 147 Quote Link to comment https://forums.phpfreaks.com/topic/85756-solved-dammed-if-i-do-dammed-if-i-dont/ Share on other sites More sharing options...
phpSensei Posted January 13, 2008 Share Posted January 13, 2008 Shouldnt you skip the slashes? "\\" Quote Link to comment https://forums.phpfreaks.com/topic/85756-solved-dammed-if-i-do-dammed-if-i-dont/#findComment-437676 Share on other sites More sharing options...
madspof Posted January 13, 2008 Author Share Posted January 13, 2008 What do you mean exactly? Quote Link to comment https://forums.phpfreaks.com/topic/85756-solved-dammed-if-i-do-dammed-if-i-dont/#findComment-437678 Share on other sites More sharing options...
madspof Posted January 13, 2008 Author Share Posted January 13, 2008 Okay doesnt matter got it Quote Link to comment https://forums.phpfreaks.com/topic/85756-solved-dammed-if-i-do-dammed-if-i-dont/#findComment-437679 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.