pankirk Posted December 22, 2009 Share Posted December 22, 2009 Hi. So I have a php script that shrinks an image making it a thumbnail image and then it uploads it to the server in a directory called "downloads" The problem I'm having is that I have the code in a folder named "includes" and I need everything to be copied to the "downloads" directory. "downloads" and "includes" are on the same level, but like i said before, my code is inside the "includes" folder. So heres my code that I have: $dest_image = "../downloads/$itemType/$itemId/".$now_time.$_FILES['preview_image']['name']; copy($_FILES['preview_image']['tmp_name'], $dest_image); (obviously theres other code around it, this is just whats causing the problem) Heres the result when I run the script: Warning: copy(../downloads/themes/25/20091221174122Jellyfish.jpg) [function.copy]: failed to open stream: No such file or directory I obviously am having trouble with the "../" and "/" before the directory name. So what am I doing wrong? Thanks! -P Link to comment https://forums.phpfreaks.com/topic/185962-directory-help-with-php/ Share on other sites More sharing options...
cags Posted December 22, 2009 Share Posted December 22, 2009 I'd suggest echo'ing out the value of $dest_image. The chances are it does not have the value you expect. I'm assuming the code in the 'include' folder is actually includeed in another file, now I always get this the wrong way around but I believe that may make the path used relative to the file that includes it. Link to comment https://forums.phpfreaks.com/topic/185962-directory-help-with-php/#findComment-982177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.