captainjustin
12-11-2010, 12:26 AM
I'm using a script that re sizes and uploads pictures to a directory in my website. The script seems to be working fine, but when I try to view the uploaded pictures I'm getting a 403 forbidden error. I contacted my hosting provider and they told me that the permissions need to be changed in the script using chmod.... I did a little research and found a way to do this using php but I'm not quite sure how to combine the scripts together.. I was wondering if some one could help me out here.
<?
set_time_limit ( 240 ) ;
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['Filedata']['name']);
$orig=$target_path;
$info = pathinfo($target_path);
$ctr=1;
while(file_exists($target_path)){
$target_path=$info['dirname']."/".$info['filename'].$ctr.".".$info['extension'];
$ctr++;
}
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $target_path)) {
echo "status=1&filepath=$target_path&size=".$_FILES['Filedata']['size'];
} else{
echo "status=0&msg=Error";
}
?>
Here is the chmod setting I think I need?
<?
chmod("upoads/somefile", 0755);
////where do I put this and what should go where (somefile) is?
?>
Thanks in advance
<?
set_time_limit ( 240 ) ;
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['Filedata']['name']);
$orig=$target_path;
$info = pathinfo($target_path);
$ctr=1;
while(file_exists($target_path)){
$target_path=$info['dirname']."/".$info['filename'].$ctr.".".$info['extension'];
$ctr++;
}
if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $target_path)) {
echo "status=1&filepath=$target_path&size=".$_FILES['Filedata']['size'];
} else{
echo "status=0&msg=Error";
}
?>
Here is the chmod setting I think I need?
<?
chmod("upoads/somefile", 0755);
////where do I put this and what should go where (somefile) is?
?>
Thanks in advance