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