PHP upload question


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: PHP upload question

  1. #1
    Join Date
    Aug 2006
    Posts
    20

    PHP upload question

    I have a question about uploading files with PHP that I was hoping someone could help me with. I am able to upload a .txt file to a directory I created called uploads, however when I open the file with my text editor it is blank. When I list the files in this directory with the ls –la command it says the owner of the file is apache and not my username. The permission are –rw-------, so I do not think I have read permission since I am not the owner, however it will not let me change the permissions on the file. It says, changing permissions is not permitted.

  2. #2
    Join Date
    Dec 2006
    Posts
    3
    Your webserver, apache, created the file, therefore it has read/write access. When you upload the file, use chmod to allow your username to have rw- access.

    http://us2.php.net/manual/en/function.chmod.php

    You may want to consider using a 3rd party uploading tool, especially if uploading lots of images, as they will help prevent future headaches. My favorite is upload.php by colin verot @ http://www.verot.net;

  3. #3
    Join Date
    Dec 2006
    Posts
    3

    create script with chown or chmod

    You can create script with chown or chmod command in PHP, which chmod or chown your "locked" file.
    After that execute that script with http request.
    Apache will do chown or chmod the file with right perrmissions, because apache user is the owner of the file.

Similar Threads

  1. Replies: 0
    Last Post: 08-28-2006, 01:58 AM
  2. Connecting to java chat server from php
    By prasad in forum Java
    Replies: 0
    Last Post: 05-15-2006, 09:45 AM
  3. Display one record at a time!
    By ASP learner in forum ASP.NET
    Replies: 5
    Last Post: 10-08-2002, 07:17 PM
  4. File upload help
    By Chris in forum ASP.NET
    Replies: 5
    Last Post: 09-01-2002, 07:46 AM
  5. Need Help: File Upload
    By Winnie in forum .NET
    Replies: 0
    Last Post: 05-20-2002, 05:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center