IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
 
Closed TopicStart new topic

Setting Permissions With Php File Uploader


Dennis56
no avatar
Newbie
*
Group: Members
Posts: 0
Joined: 8-December 06
Member No.: 34,877



Post #1 post Dec 8 2006, 01:46 AM
How can i allow for people to upload images from my site to another path?

When i made the script i get this error

QUOTE
Warning: move_uploaded_file(uploads/38120806topic_split.gif): failed to open stream: Permission denied in /home/ninjach/public_html/upload.php on line 26

Warning: move_uploaded_file(): Unable to move '/tmp/phpQyLuQt' to 'uploads/38120806topic_split.gif' in /home/ninjach/public_html/upload.php on line 26
Go to the top of the page
+Quote Post
BuffaloHELP
no avatar
More than meets the eye
******************
Group: Admin
Posts: 3,696
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:19.60



Post #2 post Dec 8 2006, 01:55 AM
It would be nice if you posted your source code...? Otherwise it's all in the speculation.

And note the QUOTE bbcode tag I added? smile.gif
Go to the top of the page
+Quote Post
Dennis56
no avatar
Newbie
*
Group: Members
Posts: 0
Joined: 8-December 06
Member No.: 34,877



Post #3 post Dec 8 2006, 02:07 AM
CODE
if(!isset($_POST['upload'])) {
echo '
<form name="upload" enctype="multipart/form-data" method="POST" action="'.$_SERVER['REQUEST_URI'].'">
<input type="file" name="file" size="13" value="">
<br /><input type="submit" name="upload" value="Upload">
</form>
';
} else {
if(
($_FILES["file"]["type"] == "image/gif") ||
($_FILES["file"]["type"] == "image/jpeg") ||
($_FILES["file"]["type"] == "image/png") ||
($_FILES["file"]["type"] == "image/jpg")
){

$uploaddir = 'uploads/';
$filename = $_FILES['file']['name'];
$filesize = $_FILES['file']['size'];
$tmpname_file = $_FILES['file']['tmp_name'];
    $date_file = date(imdy);
move_uploaded_file($tmpname_file, "$uploaddir$date_file$filename");

//Connection MySQL

//Select DB

//update MySQL


}else{
echo"Invalid file type.";

}  
}
Go to the top of the page
+Quote Post
jlhaslip
no avatar
<?php $answer = googleit( $question ) ; ?>
*******************
Group: [MODERATOR]
Posts: 4,433
Joined: 24-July 05
From: Linix, DOS and Windows…the good, the bad and the ugly
Member No.: 9,787
Spam Patrol
myCENT:74.90



Post #4 post Dec 8 2006, 03:12 AM
In your cpanel, chmod the permissions on the temporary directory and the uploads directory to 777.
Go to the top of the page
+Quote Post
BArS
no avatar
Newbie [Level 2]
**
Group: Members
Posts: 29
Joined: 6-December 06
Member No.: 34,788



Post #5 post Dec 8 2006, 05:40 AM
Try to use "copy" function instead of "move". And remember that your file .php must have permission to create files.
I hope it will help.
Go to the top of the page
+Quote Post
Dennis56
no avatar
Newbie
*
Group: Members
Posts: 0
Joined: 8-December 06
Member No.: 34,877



Post #6 post Dec 8 2006, 06:06 AM
I got the problem solved thank you everyone

This post has been edited by Dennis56: Dec 8 2006, 06:12 AM
Go to the top of the page
+Quote Post
BuffaloHELP
no avatar
More than meets the eye
******************
Group: Admin
Posts: 3,696
Joined: 23-April 05
From: Trap17 storage box
Member No.: 6,042
myCENT:19.60



Post #7 post Dec 8 2006, 06:10 AM
You can do two ways:

1) access your cPanel, click on the folder (not the folder icon) you're trying to change mode, right hand menu "change permission." This is done through File Manager.

2) using your FTP software, right click on the folder and select the permission or chmod menu. This is different from which FTP software you're using.
Go to the top of the page
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   0 noxit 2,524 20th June 2004 - 02:06 PM
Last post by: noxit
No New Posts   8 -Pandemonium- 641 25th August 2004 - 04:00 PM
Last post by: -Pandemonium-
No New Posts 4 BoSZ 543 17th December 2008 - 05:15 PM
Last post by: buxgoddess
No New Posts   2 Eric Straven 388 8th September 2004 - 02:57 PM
Last post by: ZorBiX
No New Posts 6 dozen 352 9th September 2004 - 11:58 PM
Last post by: Triple X
No New Posts   4 annylei 371 14th September 2004 - 09:38 PM
Last post by: Triple X
No New Posts 9 jailbox 410 10th October 2004 - 08:01 AM
Last post by: whatknows
No New Posts   0 anwiii 674 14th June 2006 - 08:44 AM
Last post by: anwiii
No New Posts   2 Inty 384 3rd October 2004 - 11:17 AM
Last post by: mobileunlocking
No New Posts   5 -prodigy- 354 6th October 2004 - 06:37 AM
Last post by: -prodigy-
No New Posts   3 josh_sg1 419 12th October 2004 - 12:02 AM
Last post by: s2city
No New Posts   3 s2city 394 10th October 2004 - 07:44 PM
Last post by: s2city
No New Posts   8 sohahm 399 21st October 2004 - 08:44 PM
Last post by: beg4mercy
No New Posts   0 sohahm 254 16th October 2004 - 01:46 AM
Last post by: sohahm
No New Posts   12 Lyon 2,183 29th April 2006 - 10:27 PM
Last post by: netsevdam


 



RSS Open Discussion Time is now: 8th January 2009 - 09:16 AM