Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





File Permissions On Upload


I am uploading picture. This is part of the code

if(!move_uploaded_file($_FILES['fullSizePic'.$propId.$i]['tmp_name'], '../images/properties/'.$imageName) ){
chmod('../images/properties/' . $imageName , 0777);
}

The file uploads and moves into the properties folder. That folder's chmod is 777, but the file's chmod is only 600 making it unreadable by the server. I try to chmod it with php (as you can see above) and it doesn't work.




View Complete Forum Thread with Replies

Related Forum Messages:
Upload File Permissions Problem
I've moved an existing site (which I didn't write) from a apache/php/mysql
host under windows to a linux apache/php/mysql host.
I've sorted out most problems except one.

There is an upload function on the site, which uploads files via POST to
temp folder and then moves it into a folder on the host using php function
move_uploaded_file. Under windows this works fine but on the linux host the
uploaded file is created with 600 permissions so it cannot be accessed later
by site visitors. The folder it is uploaded into has 755 permissions. Is
there a way of setting the default file permissions so each uploaded file
can be set to say 644 or do I need to chmod each file after upload?

View Replies !
Upload Permissions
Is it possible to upload stuff to a folder, and that still no-one could see it?
I want to upload stuff using php, and I don't want anybody to be able to see the folder directly. with permissions 777 it doesn't work.

View Replies !
Allow Users To Upload Images Without 777 Permissions?
I have a form that allows users to upload only .jpg files. Somehow a hacker was able to upload a php file which in turn he/she used to send out spam mail. It later occured to me that the hacker didn't even use the form because at the time there was no way for him/her to log in and access that page. Of course, the directories where I put the images have 777 permission. Can a hacker remotely upload files to a 777 folder? Is there a way to allow users to upload images without 777 permissions?

View Replies !
File Permissions
Im in the process of creating a web based frontend for a program called ASK (Active Spam Killer - http://a-s-k.sourceforge.net) and am currently running into a problem. Currently there is a perl based web front end, but it lacks functionality, and is rather bland, although it does work, and it works without changing any file permissions.

The problem im running into is that PHP requires me to make changes to file permissions (ASK files are located OUTSIDE of the web tree) which might end up causing problems as far as security and privacy of email. Has anyone come to any reasonable answer for this type of problem as im sure its a issue for other programs people write.

View Replies !
File Permissions....
I've read the stuff concerning writing to a text file and the related file permission issues on this forum.I have a script that does just that, it takes user-entered data from a Web Form and dumps it to a text file on a server.

This works fine on my private server, but is giving me the error...."Could not open stream.Permission denied on Line..." on the company server...The Company machine uses Windows XP.

I've tried talking to the System Administrator regarding the Permissions,but he says that giving READ/WRITE/EXECUTE Permissions could create Security Issues.

I have been told that previously,a script written in ASP had been used that did exactly the same thing i.e writing to the text file, but there were no File Permissions needed to be set!

View Replies !
4.3 And File Permissions
I know that the PHP "chmod" command sets file permissions, but how do I
retrieve what the permissions are for a particular file using PHP 4.3?

View Replies !
Problem With File Permissions : PHP / FTP
My php-script makes directories and puts files in it.
But via FTP'ing, I can't delete those files anymore.

Also, I need to put a whole bunch of existing files into these,
'made-by-php' directories, and that seems impossible
by means of FTP. I get an 'access denied' error every time.

View Replies !
How Can I Have Permissions To Delete A File?
How can I have permissions to delete a file? example: I have to delete a file, but I don't to public users have permission to delete that file but, with a certain "login" they can.

View Replies !
File Permissions After Copy()
This function basically creates a new dir in a determined location and copies the files from an established dir to the new dir. It copies the files and creates the folder ok, bit it sets the file permissons to 755 for the new folder and file contents. I then get a 550 error if I try to delete or chmod them. Any suggestions? I get permission errors in the script if I use the chgrp and chmod functions also. PHP Code:

View Replies !
How Do You Create A File In PHP And Set Permissions To It?
How do you create a file in PHP and set permissions to it?

View Replies !
File Permissions In Win98
I just wanted to know if there was any way I could change my file permissions so I can use the fopen function in windows 98 using Apache and PHP 4.04???? I know how to do it for Linux but I need it for Win 98.

View Replies !
Change File Permissions
i'm trying to create a file management tool online using php. Everytime i copy or create files or folders though it assigns ownership of the new files or folders to the apache id. i tried using backticks, exec, shell_exec and the php shell commands. php safe mode is off.

i can create the files and folders using shell commands and have tried to change ownership using chown but that doesn't seem to do anything. any insight can help. the goal is to be able to create these files with the same admin user ownership as all the other files on the site.

View Replies !
CHMOD File Permissions
i have a few question about file permissions. which is the best way to set a permission to a mp3 tha ti can play on the website, but if anyone try to get it from the directory they wont be able to?

like if i am playing thissong.mp3 and someone went to the directory to try and get the file music/songs/thissong.mp3 they would get some kind of error. also for folders that don't have a index file. which permission would be the bes tinstead of creating a number of index for each, but not give a use permusic to see the context if the go to mydirectory/functions/ .

View Replies !
File/folder Permissions
I have an upload function that uploads images into a folder. The folder is set to 777. However when I upload an image file to the folder, the file uploaded is set to 600. Therefore it wont appear on web. I'm not sure why this is doing this for??  Im using the php function move_uploaded_file to upload the file.

View Replies !
File Write Permissions
I'm trying to get an open source PHP app working for my company.  It's giving me the following custom error:

FreeMED was unable to create a file to record the healthy status of the system.
The FreeMED directory should be owned by the user that the webserver is running as...
Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED.

But that is not advisable from a security standpoint.
I've narrowed it down to the line of PHP that's breaking it here:

$test = CreateObject('FreeMED.FreeMEDSelfTest');
As far as I can tell, I've made the directory it's using as open as possible and it's still giving me that error.  The owner is apache (user and group) and the permissions are (temporarily) set at 0777 (universal read/write).

Is there some PHP or Apache configuration that needs changed to allow PHP this kind of permission?

View Replies !
File Permissions Windows
i am using the LOAD DATA INFILE to load from a txt file. Although it works fine with the MySQL command it does NOT work with Script...does anybody know why?

View Replies !
Rsync And File Permissions
Im sort of new to using rsync to transfer my files. unfortunately it is messing up something with the permissions, and somehow i get a 403 from the server.

View Replies !
Not Enough Permissions To Delete A File
I want to delete a file using unlink() function. I'm getting a warning that says that I have no permissions to do that.

I suppose that is because the file I'm trying to delete is under the root directory path. I searched the forum about deleting files but found nothing alike my problem...

View Replies !
File Upload Issue - Unable To Upload A Large File
I am using PHP Version 4.4.3 under Linux/Apachie to upload files.
The PHP.ini upload_max_filesize is 2M, which I need to override this
in the HTML (see below). I changed the MAX_FILE_SIZE to 4,000,000
but the system only accepts files less than 2M.

Is the override wrong, do I need to raise the limit in the PHP.ini
file, or is the Apachie issue.

<form name="upload" action="admin.php" method="post"
enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000">

View Replies !
Upload A File But I Always Get The Error Message: Possible File Upload Attack!
I'm trying to upload a file but I always get the error message: Possible file upload attack! Code:

View Replies !
File Permissions Of PHP Session Files
I noticed that the file permissions (unix) of the PHP session files
have only read and write permissions for the Apache process (600 or rw-
--- ---).

Does anyone have any idea where this permission is set ? I can't find
any
umask or chmod settings for it in the php.ini file. Can't find
anything in
the httpd.conf either. Is it set in the PHP code that implements
session_start()?

View Replies !
Creating A File, Uploading, And Permissions
I'm using php4 and i want to check for a file, if it doesn't exist it
should be created. My problem is i have to create it with specific
permissions specifically 666 so that the script can then write to it. I
don't have ftp access. I'm also looking for any tutorials, recent ones,
using php4 for creating file upload areas, i'm trying to make one of those
as well.

View Replies !
File And Directory Permissions For PHP Application
I make the directory 0777 and then write the file then i make the file i tried a few but they keep from being read im sure the file is ok i think i can handdle file permissions but i think its directory permissions im having a prob with.

Its an image file i write it and then need to use it so make the directory 0777 and then write the file and then what to the file and what to the directory ?

i am using php ftp() but if anyone knows any differences with php chmod() then please tell me apart from that i do a 777 righth now and leave it at that.

what should i being to the directory and file after to make it secure because i dont whant people tampering with them ?

OH AND THIS PROBS ON TH MAC OSX 10.4 TIGER

my chmoding works fine on linux the way it is 0777 and then a 655

+ somtimes i play with the permissions of the directory throgh the os GUI or the shell and i got it to tell me i dont have permissions in the OS but in PHP its ok is this coz PHP got ownership of it when i messed with the addtional BIT.

View Replies !
Minimun File Writing Permissions
I believe the chmod command -w- is write only, the minimum file writing permission but what is this in terms of numeric - chmod 755? or 777 .

View Replies !
File Permissions Denied Error
i'm using the following code to create a file. PHP Code:

$fn = "file.php";
    $FileHandle = fopen($fn, 'w+') or die("can't open file");
    $stringData = "Something";
    fwrite($FileHandle, $stringData);
    fclose($FileHandle);

when i check the file properties i can see that the file's permission is set to 644 so when i use the following code to delete it i get a permission denied error. PHP Code:

$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fclose($fh);

$myFile = "$file.php";
unlink($myFile);

what shall i do to set the permission to 777 when creating the file?

View Replies !
Chmod Mkdir And File Permissions..
I'm trying to create directories and move files with the right permissions. When I make a dir using mkdir I'm setting the permission to 777 to my folder variable $t2 below,

but when I check the chmod it's 755? When I copy files over to this folder the file permission are set to 644 and I can't even get rid of them on the server because it won't allow me to delete them. Is there anyway to set permissions to a file as you're using the copy function? Code:

View Replies !
Change File Permissions On Uploaded Files?
I am trying to find a way to change the default file permissions for uploaded files using PHP. When I upload a file using my PHP script the default file permissions are 755. I would like the file to have 744.

View Replies !
What File Permissions To Keep Files Safe From Outside Users
My php source files should have what file permissions to keep them safe from outside users.I have chmod 711 but i want somefiles to be able to be downloaded eg txt,doc files.

View Replies !
Set Up The Permissions So That My Script Can Simply Fopen A File For Writing.
I am rather new to PHP and a relative newbie to Linux too.
I have a webserver at home (Apache 2.0.48 on SuSe 9.0, PHP4).
I have some scripts, one of them needs to be able to create logfiles
somewhere on my machine. It must also later be able to read from and write
to these files again.

Sofar I get a permission error. I tried chmodding 666 or 777 the directory
in which the files could reside, to no avail.
How do I set up the permissions so that my script can simply fopen a file
for writing. Or if that's not the issue, what am I doing wrong or
overlooking ?

The errors:
Warning: fopen(logfileslog1.txt): failed to open stream: Permission denied
in script1.php on line 142
Warning: fwrite(): supplied argument is not a valid stream resource in
script1.php on line 154
Warning: fclose(): supplied argument is not a valid stream resource in
script1.php on line 161
It's the first I am puzzled about, the 2nd and 3rd are a logical
consequence.

By the way, reading from and writing to a file I have previously created
myself with exactly the names I tried to get created by the script (echoed
the name, ok) is no problem at all.
So I don't think it has much to do with a safemode or open_basedir setting.
I also tried creating the scripts in the same dir the script itself resides.
Did not work either.

View Replies !
Linux File Permissions On Maildir, Apache User
i have the following problem. I am trying to create maildir
directories on the local filesystem then chmod, chown them to
courier:courier (for courier mail server). the courier mail server
reads and writes on these maildirs on the local filesystem and they
need to have courier:courier ownership. it does not work because the
directories are created with apache:apache ownership and apparently
only root can change ownership. My question is as follows. Is the
only solution to this problem to add the courier user to the apache
group?

View Replies !
Open A File To Store Some Date :: Permissions Dilemma
I want to open a file to store some data. However, when I use fopen('filename', w) I get permission denied. So, I've changed the permissions of the directory to get rid of the permission denied problem. Unfortunately, this seemed to require changing the directory to have permissions 777.

View Replies !
File Upload Problems - Upload A File To The Server.
I am trying to upload a file to the server.
http://chops.novatrope.com/game/test/form2.html
Here is some more debugging info:Array
(
[userfile] =Array
(
[name] =Pequot.gif
[type] =>
[tmp_name] =>
[error] =3
[size] =0
)

)

I am usiing code from the php manual.
Here is the php info http://chops.novatrope.com/info.php

<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/usr/home/arthur/public_html/game/test/uploads/'
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>'
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.
";
} else {
echo "Possible file upload attack!
";
}

echo 'Here is some more debugging info:'
print_r($_FILES);

print "</pre>";

?>

and here is my html

<!-- The data encoding type, enctype, MUST be specified as below -->
<form enctype="multipart/form-data" action="getfile2.php" method="POST">
<!-- MAX_FILE_SIZE must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<!-- Name of input element determines name in $_FILES array -->
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>

View Replies !
File Upload Problem - Upload Multiple Files
I'm trying to upload multiple files. I'm using the chm file from
php.net to help me figure it out. I also checked online and say theres a
problem with the file. Anyway My html looks like this:

View Replies !
Upload Jpg With Ftp -fine, Upload With Php Wrong File Type!
i've scripted a file uploader, about as basic as you can get, and works on all accounts except that it tells me every single jpg is the wrong file type - BUT i can ftp all these same images and they all behave correctly.

echo filetype($type_file);

//got this warning
Warning: filetype() [function.filetype]: Lstat failed for image/pjpeg
any ideas?

View Replies !
Upload All The Files And Change "permissions" To "755".
I just got a mini-poll php script, all it said was to upload all the files and change "permissions" to "755". i am totaly new to PHP and have no idea what "permissions" means or how to change it?

View Replies !
.php Files - Permissions Are Set Public Readable - So Can Public Get To See Actual Raw File?
As a newbie to PHP is it in anyway possible for a casual web surfer to
actually get to see the PHP behind my .php file.

E.g.

if index.php contained PHP code to check if the page had been called with a
variable such as "password", is there anyway a public member can get to see
the raw php file and therefore see what the password is?

index.php might be:

if ($_REQUEST[password]="secret") {[color=blue]
>Then show one page[/color]
else[color=blue]
>show another page[/color]
}

So if a user visits with
index.php?password=secret

they get to see the secret page.
But as the index.php has to have file permission set so that anyone can read
it, I'm worried that the public can just somehow view the file and learn the
password.

View Replies !
File Upload - Nothing In The $_FILES Array After Selecting A File And Clicking Submit
I have to following HTML form to upload a file:

<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<input name="userfile[]" type="file" />
<input type="submit" value="Submit" />
</form>

In my upload script I have:

if(is_uploaded_file($_FILES['userfile']['tmp_name']))
{
..do some code, etc.
}

There seems to be nothing in the $_FILES array after selecting a file and clicking submit. Any ideas why? All I get is this when trying to echo some of the $_FILES variables: File Array is Array bytes, i.e. the word Array is just being printed instead of the relevant info.

View Replies !
Upload A File And Have  Alink Of The File Displayed On The Webpage.
I want to upload a file and have  alink of the file displayed on the webpage.

q)Now I can do an image but is there anything else i need to know? eg fileupload and store on a dir and have a link to the file in  mysql. The file would be .txt ot .doc etc

q)Is there a way to upload  a lot of text eg 2000 words to a webpage and have the content displayed on a webpage ?

View Replies !
File Upload Fails - Different Files And Sizes And The Time Required Seems To Be Proportional To File Size,
I'm using IE5.5 as client and php4 on linux/apache as server. I've followed the examples for doing a file upload from a form and everything appears to work from the client side. In my script I see the following values:

UploadedFile=none
UploadedFile_name=test.html
UploadedFile_type=text/html
UploadedFile_size=0

I've tried different files and sizes and the time required seems to be proportional to file size, so I think there is a file being sent by the browser. The UploadedFile_name and type reflect the file being sent. Since I'm not getting a name for the temporary file in UploadedFile (if it was in fact created) and size = 0, I can't move or copy it. Code:

View Replies !
Email With File Attachements - How To Upload File To Server From Browser?
I have a PHP script that sends an email with attachment and works great when
provided the path to the file to send.

However this file needs to be on the same server as the script.

I want to develop a webpage where people can send attachments that are
stored on their local PC.

I know I can use the <input type="file" > HTML to generate a file box that
allows the user to navigate to a file on their PC and product a file path,
but how do I then upload this file onto file server to email out with my PHP
email script?

Is there an easy way to do this?

Or can I approach this problem from a completely different angle.

View Replies !
File Upload Warning: Max File Size Exceeded
I have 2 files, one is a HTML file with the code to create a Browae and Submit Button for uploading a file. (This works fine). BUT, when I click the submit button, I want the file to upload to a directory on my C:/ drive which I have indiciated in the PHTML file, but I keep getting the following error and I don't know why.

Warning: Unable to open 'php2' for reading: Unknown error in C:apachehtdocs/submitassprac.phtml on line 5 Couldn't copy the file! OR

Warning: Max file size exceeded - file [img1] not saved in C:apachehtdocs/submitassprac.phtml on line 0 Code:

View Replies !
File Upload :: Warning: Fopen - No Such File Or Directory
I’m getting the following errors when I try to run the script below on a live server. It’s a crude script which uploads text and images directly into MySQL. It works fine on my local machine, I have Apache, PHP4 and MySQL running on windows. The live server is Unix.

When I try to upload images from my loacal pc I get the error below, when I placed an image file within the same directory as the script on the live server and tried to upload it that worked. I wanted the script to allow image uplload from a client pc Can anyone offer a suggestion?

Warning: fopen("C:Apachehtdocs Grey.jpg", "r") - No such file or directory in /usr/local/home/httpd/vhtdocs/sitehostin/moondance/backend/test_imagedb.php on line 57
Code:

View Replies !
PHP File Upload Unexpected Error - File Too Large?
I have a short basic script to upload files. It works fine with small files,
but with longer files it gets stuck.

Here's the fragment, the input file is loaded in "$file" from an HTML form
as usual.

....
$img_str = fread(fopen($file, "r"), filesize($file));
$data = addslashes($img_str);
// --------------------- up to here the execution is correct and fast (<1
second)

$sql="INSERT INTO $table (".
" file_name,".
" file_type,".
" file_size,".
" bin_data)".
" VALUES (".
" '$file_name',".
" '$file_type',".
" '$file_size',".
" '$data')";
// --------------------- it gets stuck
here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mysql_query($sql) or die ("SQL error ..$sql");

I have already set the php.ini variables as follows:
memory_limit = 16M
upload_max_filesize = 6M

I also checked the execution time to max_execution_time = 300 (even though I
don't believe it should be necessary).
The server is a P4 1.8 GHz, 256MB RAM

View Replies !
File Upload Script - Testing For Existence Of File
i'm having a strange problem when processing some form data. I just want to validate that required fields have been populated, then, if an image has been uploaded, i want to ensure that a description of the image has been provided (for alt tag purposes) before processing the data.

For some reason, when a file hasn't been attached, my script interprets it otherwise and prompts the user for the alt tag. I've not come across this problem before, there's a good chance i've done something idiotic but i just can't see it Code:

View Replies !
File Upload :: 'wrong File Type' On Another Server
doing a simple image (jpeg) upload to a directory. Have a script which works fine on one server but comes up with 'wrong file type' on another server. The server that works has php5 installed, the other is 4.2.2 but I am sure what I have should work on both.

PHP Code: ......

View Replies !
File Upload NOT Using HTML Input Type=file
in an earlier post on the javascript forum i was talking about a small program i'm writing to allow file uploads through the http protocol that look and function similar to a ftp client.

I have made some nice progress on this project and am able to return the FSO collection from the client pc. this allows me to list of directories on the page so users can select multiple files to upload at once or even entire directories. Code:

View Replies !
File Upload, Set Defalut File Name, Hide Form
I found and used a number of handy tutorials on PHP/MySQL/HTML file upload. I have a working model. What I would REALLY LIKE is to find a way to establish a default file name and location for that upload and HIDE the html form.

That, or a short and sweet line of code that simply post the file from it's location to the table/row/coulmn of my choice.

View Replies !
File Upload - Any Way To Get The Path Of The File On Users Computer?
Producing a html form with file upload. I am working on the error checking and when the page is submited, if their is errors on it I want the pathname of the image to remain in the html file box, so the user does not have to re-select it.

ie html form:

<input name="pictures[]" type="file" size="30">

I know you can get the name via

$_FILES['userfile']['name']


but is their any way to get the full path name?

I though PHP Code:

$_POST['pictures'][0]

ect might work but it doesnt.

View Replies !
File Upload - Directory Is Writable, File Is Not
I'm writing a script to upload images along with articles to a
directory on the server. I'm developing it offline on my WinXP and
Apache 1.3.x laptop and it's working great, but when I move the script
to the server, I get write errors when the file attempts to upload.

So I set up a test script (included below) to test the directory
structures all the way up to the file, and every directory appears to
be writable, yet I can't write to the test file. I keep seeing
suggestions to set the open_basedir directive in the php.ini file to
solve this, but it's hasn't worked yet. Can anyone suggest what I can
try to get the uploads working?

<?php

$filename = 'images/articles/test.txt'
$somecontent = "Add this to the file";

......

View Replies !
File Upload Handling (file Types Etc.)
I have two questions. First, how can I control what files a user uploads? I can, of course, check the extensions but they can't always be trusted. Can I check the mime-types somehow? Second, is there a way I can set the "available formats" in the file upload dialog box?

View Replies !
File Upload Bigger File Size
i can upload small files. however i cannot upload bigger files-but max_file_size is set correctly. what can be wrong? is it connected witrh my browser?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved