Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
File Access problem

 
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum
Author Message
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: File Access problem Reply with quote

I have a situation here
1. I upload files to my host pics directory
2. the pics folder is 777 permission

files are uploded correctly but the fils mod is not automatically set to 777

as a matter I can't see the images for permission denied.

Upload process are through php coding.

I need solution, I think some .htaccess can make this solve?
anyone?
_________________
Sarder Hasnut
MCSD, CIW A

Need Low Cost Prefessional Hosting Contact me
Thu Oct 07, 04 6:22 pm
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

I think, the problem is with the file uploading with PHP. I don't know what code you are using. But if the method is not FTP then the file permission is usually set to www, instead of normal read-write-group etc. So that might be a problem. Another thing that you can do is, write the script as such so that it changes the permission everytime a file is being uploaded.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.


Last edited by quantum on Fri Oct 08, 04 10:33 am; edited 1 time in total
Fri Oct 08, 04 12:54 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: Reply with quote

but its there htaccerss to make this solve so whatever place in the folder will make the same perission.

I set the folder permission 777
_________________
Sarder Hasnut
MCSD, CIW A

Need Low Cost Prefessional Hosting Contact me
Fri Oct 08, 04 7:38 am
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

Can you post the relevent .htaccess code her?

I had a similar probelm once. I wrote web based upload program to upload multiple files. Images and html. This was the same problem that happened with me. The server was assigning its permissions to www automatically. The directory had write permission though.

But I found out later that if I use FTP command for php to upload, it works just fine.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Fri Oct 08, 04 10:31 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: Reply with quote

Quote:
I use FTP command for php to upload

how? which command
_________________
Sarder Hasnut
MCSD, CIW A

Need Low Cost Prefessional Hosting Contact me
Fri Oct 08, 04 10:37 am
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

You can find the complete code here. Browse and Upload multiple files with FTP browsing.

[http://www.quantumcloud.com/forum/viewtopic.php?t=273]
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Fri Oct 08, 04 10:46 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: Reply with quote

This
Code:
@chmod($newfile,0777);
code worked for me.
Thank you Here is the whole code. I posted if someone get help from this.

Code:
<?php
$numoffile = 6;
folder
//actuall path of the image folder
$file_dir  = "/home/gdebedin/mainwebsite_html/pics/";
@chmod($file_dir,0777);
if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$newfile = $file_dir.$_FILES['myfiles']['name'][$i];
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);
@chmod($newfile,0777);
$j++;
}
}
}
if (isset($j)&&$j>0) print "<h3>Your file(s) has been uploaded.</h3>";
print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='30'>
";
}
print "<input type='submit' name='action' value='Upload'>";
print "</form>";
?>

_________________
Sarder Hasnut
MCSD, CIW A

Need Low Cost Prefessional Hosting Contact me
Fri Oct 08, 04 12:45 pm
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

Very nice. I am Glad that you got it figured out. Gentle smile
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Fri Oct 08, 04 12:59 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group