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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.