Jump to content

File upload problems


Yesideez

Recommended Posts

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 39

Warning: 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

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

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.