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 Complete Forum Thread with Replies
Related Forum Messages:
Creating A Zip/rar File When Uploading
when a user uploads a file to my site i was first of all wanting to put the file into a zip/rar file for easier downloading i havce this so far: // create a zip file with file inside... $createZip = new createZip; $fileContents = file_get_contents(uploads/$filename); $createZip -> addFile($fileContents, $filename); $fileName = "$filename.zip";
View Replies !
Uploading Permissions...
When I try to upload a file through the browser, it has this error: Warning: move_uploaded_file(/home/snoman/public_html/pytoys/images/figures/cry.gif): failed to open stream: Permission denied in /home/snoman/public_html/pytoys/upload.php on line 11 can anyone help me solve this problem?
View Replies !
Uploading With Permissions
Firstly i am working with php in an enviroment that supports unix-like permission in an accademic environment. The problem is enabling my script to upload a image file to my home folder, called say photoFinalDestination. so far i have set up my groups to 'www' with read, write and execute permissions on the folder photoFinalDestination from within unix my php script is the template from php.net obviously modified for my filenames and stuff. Code:
View Replies !
Change The Folder Permissions For Uploading To Work
I want my users to be able to upload images to my website. I think I need to change the folder permissions for this uploading to work, not sure how to do this though, I have tried the below but it doesn't work. PHP Code: $uploaddir = chmod("/images/directory", 0777); Here is the code for the page: PHP Code: $uploaddir = "/images/directory"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777
View Replies !
Uploading Images And Creating Thumbs From It
I have a problem with uploading images and creating thumbs from it. Not all the time, but sometimes, the full size image is completely uploaded and correct, while the thumbnail only builds a vertical part of the real image... the rest is grey. How is that possible? Uploading is not the problem, but resizing somehow is i guess.
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 !
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 !
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 !
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 !
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 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 !
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 !
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 !
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 !
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 !
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 !
Uploading A File And Checking Form Fields, Without Reselecting File?
I've got a page upload1.php which contains a form that asks the user to select a couple of variables: File owner (compulsory) Menu ID (compulsory) File Description (optional) File to upload This form then goes to upload2.php where I check the form values, and if all ok write the info to my database and upload the file. File owner and MenuID are compulsory, the first thing upload2.php does is check that these are completed. If either field is missing, the form is presented again for the user to complete the missing fields. Fields that were completed are carried forward into this form so the user doesn't have to re-enter. the question: While I can carry the other fields forward from upload1.php to upload2.php, I can't figure out how or if I can carry forward the location of the file to be uploaded so the user doesnt' have to reselect? Form from upload2.php follows. Area in question is highlighted - it's my best guess, but it doesn't work.....
View Replies !
Creating Link To File Or Temp File For User Download
I am designing a document management system (DMS). The files are stored in a directory on the webserver. The filenames for the documents are stored in a MySQL database. The DMS will track revisions from the initial version through the updates. We must have strict permissions set so only authorized personnel can access some documents. All of the documents when uploaded are given totally random names such as "114723fb5422c6bd5ed18f6.doc". Is there a way, without the webserver creating a new file name "document_specs_ver2.doc" to have the file download named "document_specs_ver2.doc". If I must physically create a new file, how do I know when the webserver would be allowed to delete it? Notes: The files will be in several different file formats, not just "doc".
View Replies !
Uploading A File.
Trying to upload a file ( gif or jpg image) to a server. The 'upload_tmp_dir' is not defined so, I'm assuming that the file is in either /var/tmp or /tmp. I can't seem to get a valid file handle. Even the variables that are suposed to be defined ( $UploadFile_name, $UploadFile_size, and $UploadFile_type) are all not defined.
View Replies !
[FAQ] File Uploading
Q: How should I handle file upload? A: File uploading requires HTML form of content type "multipart/form-data". The file content has to be POSTed/submitted via the form and once the file is uploaded, it will be available at the "upload_tmp_dir" (usually /tmp) directory. Then you may move that file to another directory using move_uploaded_file(); file name will be available in the superglobal $_FILES['userfile']['tmp_name']. Q: How to upload a huge file to the server? A: Uploading depends on various factors: 1. Browser timeout/capacity/configuration 2. Available space and memory at the server 3. PHP's setting to handle uploads and POST data In most of the cases, you could be able to adjust only the (3) Refer: Q: How to implement progress/status bar for file uploading? A: This is impossible in PHP as it doesn't populate HTTP_RAW_POST_DATA natively. Anyway, there are few hacks available: 1. Patching PHP <http://pdoru.from.ro/upload-progress-meter/> 2. Using Perl <http://www.raditha.com/php/progress.php> 3. Finding the size of "upload_tmp_dir" directory at some interval, originally suggested by Reader Ron in <news:42f90a1a.0402252007.72d72cba@posting.google.c om> Caveats: There is no speculation that patching solution will be implemented natively in PHP. (3) seems to be the only pure PHP hack; however it won't work when multiple files are been uploaded at the same time.
View Replies !
Re:[FAQ] File Uploading
How can I set up PHP CLI as CGI? Do I have to change Apaache's httpd.conf? The she-bang only works under *nix, can it work on a windows machine? http://eye.cc php newsgroups
View Replies !
Uploading Php File
I need to have scripts set up in order for my website to work properly. Problem is I don't have the slightest idea how to go about setting up the scripts for my website - didn't even know what scripts were until a couple days ago. In the installation manual for the scripts, I am instructed to "upload and run the config.php file." How do I access the form from which to upload the file.
View Replies !
File Is Not Uploading
I have been trying to integrate a file upload script into a script that inserts stuff into the database. I've been trying all day and don't see why it wont work. It works fine by itself, but when added to the other script it wont work. Code:
View Replies !
File Uploading In Php
i have written a script in php for uploading files to my site.and it works well.But when two users upload a file with same file name the newer file replaces the olderone.for thing i want to store uploaded file by renaming according to primary key but uploading file type is not known ,so i cant rename the file.
View Replies !
Uploading A File
I have a simple upload form from manual that goes like this: <form enctype="multipart/form-data" action="list.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> list.php then searches "/upload" and lists all the files found in there. Code:
View Replies !
Uploading The Pdf File
Iam new to PHP,please help me.I written the code for uploading downloading the files,the txt files are uploded and it can be viewable also,but while uploading the pdf and word document file,i will get an error message that Warning: fread(): supplied argument is not a valid stream resource in C:wampwwwupupload.php on line 26 Warning: fclose(): supplied argument is not a valid stream resource in C:wampwwwupupload.php on line 28 the code is here .......
View Replies !
File Ftp Uploading
i try uploading txt files and microsoft document files... when i gonna download it using a php stuffs... there are added characters placed above and below the microsoft documents and even below.... the worst is those characters are not readable.... using the move_uploaded_file() // in moving uploaded files to its desired directory...... so i can i made downloaded files without those added characters?
View Replies !
Php Uploading File Using FTP
I am having problem uploading files via FTP, but have a little bit of problem with the code, any help would be greatly appreciated. here is my code: if (isset($_POST['Submitted'])) { header('Content-type: image/jpeg'); $location = $_SERVER['DOCUMENT_ROOT'].'/common/pictures/' $newFile = "test.jpg"; //$this->generateImageName($image).".".$this->getImageType($image); $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id,$login,$password); // check connection if ((!$conn_id) ¦¦ (!$login_result)) { echo "FTP connection has failed!"; exit; } else { echo "Connected to Server!<br/>"; } echo "File Destination: ". $location.$newFile."<br /> "; echo "Temporary File: ". $_FILES["userfile"]["tmp_name"]; $upload = ftp_put($conn_id, $location.$newFile, $_FILES["userfile"]["temp_name"], FTP_BINARY); // check upload status if (!$upload) { echo "Ftp upload has failed!"; } else { echo "Uploaded successful"; } ftp_close($conn_id); } Connected to Server!<br/>File Destination: /usr/local/psa/home/vhosts/ksmarket.com/httpdocs/common/pictures/test.jpg<br /> Temporary File: /tmp/php0bX9Qk<br /> <b>Warning</b>: ftp_put(): /usr/local/psa/home/vhosts/example.com/httpdocs/common/pictures/test.jpg: No such file or directory in <b>/usr/local/psa/home/vhosts/example.com/httpdocs/admin/main/items/add.php</b> on line <b>31</b><br /> Ftp upload has failed! the permission for the /common/pictures/ directory is set to 777.
View Replies !
Uploading File
I have created a form that allows user to upload excel files to server folder. However, anything over 2MB won't upload because too large. How do I allow large files to upload? Tried changing this but no difference... <input type="hidden" name="MAX_FILE_SIZE" value="3000000">
View Replies !
Uploading CSV File
i m trying to upload a csv file into a database that already has a table created,but nothing seems to happen,no error messages. spot my mistake?
View Replies !
With File Uploading
I want to make a video uploader interface for the visitors of my site so they can upload videos to the server. The problem is that I'm not good at PHP and no tutorials proved much use to me. So I'm asking you PHP pros if you could write the whole code ofr me please? I would be very grateful to you. Heres the information which you may require to write the correct code for me: The address of my site is www.advanced-walkthroughs.com Only video files showed to allowed to be uploaded with exception of the MP4 and DVD formats. *Max file size allowed should be 80MB. The uploaded files should be sent to a folder named "uploads" which I have already created. The address to the folder is www.advanced-walkthroughs.com/uploads.
View Replies !
Uploading, Tmp File
I guess first off I should let you know I am using a "newer" edition of apache2triad on my winxp. It is using versions php5 and mysql 4. The problem I am having is that a tmp file is not being created. after using an upload form. I get this after the form is submitted when I do a print_r to $_FILES Array ( [name] => 2 SIDES.jpg [type] => image/jpeg [tmp_name] => C:apache2triad empphp88.tmp [error] => 0 [size] => 188198 ) The problem is that the tmp_name file is never created. I've tried using the file_exists function to tell. but I also cannot see it when I go to that directory/folder. Has anyone else had this problem before or know how to fix it?
View Replies !
File Uploading
I have become aware that one cannot get the path from an upload box in PHP, so I am looking for some suggestions. I have a registration page that requires uploading an image. This then submits all data to another PHP form where everything is checked, then written to the DB if the valuse are ok. If not, I set a cookie with the errors and registration data, then redirect the browser back to the registration page. The registration page reads the cookie for the errors and the values to repopulate all of the fields. Question: How can I make the <input type=file> repopulate with the users selected image so they don't need to browse to it again? Any suggestions?
View Replies !
|