SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Uploading with PHP
-
Feb 8, 2001, 23:44 #1
- Join Date
- Jan 2001
- Location
- Exeter, Devon, UK
- Posts
- 477
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi there,
I am currently trying to create a file upload script for use with my site. I have everything working with regards to actually getting the file up onto the server and into the right directory etc, but every time I upload a file, it's set so that not being a superuser on the server, I can't overwrite it or delete it.
I've chmodded the destination directory as 777 but that didn't work and using PHP's chmod command after the file is uploaded doesn't work as it is already set so that only a superuser can modify it, so the script dies.
Any ideas on how to get around this?
-
Feb 8, 2001, 23:47 #2
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well when you upload a fiel to your server the user that runs the web server is the owner f the script, so you should write a script to delete the uploaded files, because it runs as the user that owns the uploaded files. does that make sense?
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Feb 9, 2001, 10:21 #3
- Join Date
- Jul 2000
- Location
- Perth Australia
- Posts
- 1,717
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ie - use <? unlink($filename);?> and 777 is bad ...
-
Apr 29, 2001, 02:36 #4
- Join Date
- Jan 2001
- Posts
- 72
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I have the exact same problem... only the files are owned by "www" and i canīt delete, chmode, or even read them!!
When i try to use them (link them in a webpage) itīs just like they are not there.
I canīt even dowload them! When i try to download from Cuteftp, it says file does not exists.
how to fix this?, is there a way to change the owner of the file (within a php script)?
Or at least a way of use them (link them from a webpage) (since i know i can write a script to delete them).
Thanks in advance
-
Apr 29, 2001, 03:02 #5
- Join Date
- Jan 2001
- Location
- Alkmaar, Netherlands
- Posts
- 710
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
php runs as nobody on the server
so when you upload a file its owner is nobody, not you. You can try to run your php upload script as cgi, just place line below on the first line of your script and save as upload.cgi and set chmod 755, hope your host supports it.
#!/whatever/your/phpis
-
Apr 29, 2001, 07:59 #6
- Join Date
- Jun 2000
- Location
- Sydney, Australia
- Posts
- 3,798
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I know that if your host has safe_mode ON then you have to run the upload script as a CGI because otherwise your script will not be able to access the uploaded file because it is sitting in the temp directory which is outside your document root (www) directory.
-
Apr 29, 2001, 08:47 #7
- Join Date
- Feb 2001
- Location
- Las Vegas, NV
- Posts
- 118
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Im having the same problem, what I'm wondering is- is there a way to chmod in php so that at least my scripts could alter a file. What I'm having trouble with is my script uploads a file (an image) and then it tries to use imagemagick to change the image but the permission settings wont let it.
-Jordan
Bookmarks