/    Sign up×
Community /Pin to ProfileBookmark

Upload and premissions

I have an upload script that works fine, but now the server admin changed it so the saved files don’t have the correct permissions. I want everything to be 644 (user rw everyone else r). now when it is uploaded it saves as 600 so no one can see it. This script uploads pdf files to a directory that users can view using the website.

How do I get my script to make the correct permissions?

[code=php]
$newfilename = $_FILES[‘thefile’][‘name’];
$source = $_FILES[‘thefile’][‘tmp_name’];
$target = “bulletins/” . $newfilename;

echo “<h2>Uploaded</h2>”;
[/code]

**Edit**

So basicaly I get the file from the user that uploaded it, then put it into a folder that I want the users of the website to be able to download. This system allows someone with no website experence to upload weekly pdf files that users can then view on the website. The problem is it (the php script) has write premissions to that file, but users that view the website do not have the premission to view the file.

What I could do is just use a php script to get the php file and stream it using the content deposition header (or whatever it is, i have it some where) but i would prefer just to allow the users to download the files

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@JustinauthorDec 26.2006 — How do you change premissions with PHP?
Copy linkTweet thisAlerts:
@NogDogDec 26.2006 — [url=http://www.php.net/chmod]chmod()[/url]
Copy linkTweet thisAlerts:
@JustinauthorDec 27.2006 — I didn't even think that chmod was a valid option in php, thanks again!
×

Success!

Help @Justin spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...