Strange Upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Strange Upload

Post by Addos »

Just wondering if anybody has seen this before. I have a folder on the server that stores images to be added to a queue of emails that I'm sending out. This works perfectly for me when I physically drag and drop an image (.jpg) into the folder using CS3 FTP but when I use a simple file upload script then the attachment doesn't get sent.

I can clearly see that the file has been uploaded to the folder using the PHP script as I can see it in the folder and I'm very puzzled as to why the FTP one is recognized but the File Upload one isn't. I can't see any difference and have used the exact same file for FTP and the upload script and it makes no difference. It's like the Upload PHP file is something
different by the time it's uploaded yet if I type a path to this folder I can browse all the images perfectly.

Anyone seen this before?

This is the PHP upload script that I use regularly and it's never given a
problem.

Code: Select all

if ($_FILES['fupload']['type'] == "image/jpeg") {
 
            $source = $_FILES['fupload']['tmp_name'];
            $target = "folder_1/folder_2/" .$_FILES['fupload']['name'];
            /* strip htlm tags white and make lowercase. */
             $clean = strip_tags(trim(strtolower($target)));
           //strip any spaces
           $clean= str_replace(' ' , '_' , $clean);
          move_uploaded_file( $source, $clean ); // or die ("couldn't copy");
        echo '<br><strong> File'. $clean . ' ' . 'was successfully Uploaded.</strong>';
       }
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Strange Upload

Post by VladSun »

Sounds like a permissions/owner issue.
There are 10 types of people in this world, those who understand binary and those who don't
Addos
Forum Contributor
Posts: 305
Joined: Mon Jan 17, 2005 4:13 pm

Re: Strange Upload

Post by Addos »

Sounds like a permissions/owner issue.
Thanks for the fast reply. I have heard about this but really have no idea where to look. I’m on a Linux server with access through DirectAdmin and after that I’m not really sure where to go from here. I can set directory permissions and have done so 777 so that I can upload files and I have used this before without any problems.

How do I go about seeing the permissions locally that I have and compare these with the ones on the server?

Thanks again
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Strange Upload

Post by VladSun »

Go to Files seciotn in DirectAdmin and compare them :)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Strange Upload

Post by aceconcepts »

Did you create the directory manually?

If so, try creating the directory by code.
Post Reply