Jump to content

[SOLVED] Dammed if i do Dammed if i dont


madspof

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/85756-solved-dammed-if-i-do-dammed-if-i-dont/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.