Yesideez Posted August 14, 2006 Share Posted August 14, 2006 Here's my code:[code] if ($_POST['subuploadpic']) { if (move_uploaded_file($_FILES['picfilename']['tmp_name'],$targetfile)) { $msg="File uploaded"; } else { $msg="File upload failed: $targetfile"; } }[/code]$targetfile is set to "/profiles/zeb/profile.jpg"If I upload "derek.jpg" it fails. If I set $targetfile to "/profiles/zeb/" it fails. If I leave $targetfile empty it works but uploads the file into the root folder. I've tried setting both folders "profiles" and "zeb" to maximum rights (read+write+exec) and still it fails. I've tried every possible combination of folder names even having $targetfile set to "a.jpg" and it will upload derek.jpg into the root folder as a.jpg but I just cannot get it into that folder located at "/profiles/zeb/"Can anyone see where I'm going wrong? This is the error message I get:[code]Warning: move_uploaded_file(/profiles/zeb/profile.jpg): failed to open stream: No such file or directory in /home/randgigs/public_html/profile.php on line 39Warning: move_uploaded_file(): Unable to move '/tmp/phpLsVGHr' to '/profiles/zeb/profile.jpg' in /home/randgigs/public_html/profile.php on line 39[/code] Link to comment https://forums.phpfreaks.com/topic/17565-file-upload-problems/ Share on other sites More sharing options...
Yesideez Posted August 14, 2006 Author Share Posted August 14, 2006 I fixed it by removing the first "/" in $targetfile - weird!!!Only problem is: the folder "zeb" keeps resetting back to chmod(read+exec) - any idea why? Link to comment https://forums.phpfreaks.com/topic/17565-file-upload-problems/#findComment-74799 Share on other sites More sharing options...
Yesideez Posted August 15, 2006 Author Share Posted August 15, 2006 Hi guys, I'm still in need of help here if anyone can help...When users register on my site (they're limited to only a-z characters) they have a folder made in a "profiles" folder which is their username. All their profile images are uploaded here.When viewing their profile even if logged in I keep getting a 403 (Forbidden) and can't figure out why - anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/17565-file-upload-problems/#findComment-74945 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.