Page 1 of 1

problem with creating folder and upload file in IIS7

Posted: Sat May 15, 2010 11:09 pm
by mzarei
Hi Guys
i try to make upload script for my website
each user can upload document , after that i want to create folder for each user then upload files in that

Code: Select all

$userdir = $user_id ;
$upload_dir = "uploads/{$userdir}/";

i make uploads folder in my wwwroot then i wana make folder same as each user id , then upload files in that folder
   
 if (!is_dir("$upload_dir")) 
{
        mkdir($upload_dir ,0777);
        chmod($upload_dir, 0777);
}
i using dotnetpanel as my website control panel
and IIS7 webserver
but this script cant make the folder and upload file 

if (!is_writeable("$upload_dir")) {
      die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)");
    }
it's always going to die !!!
please help me !

Re: problem with creating folder and upload file in IIS7

Posted: Sun May 16, 2010 12:27 am
by Jonah Bron
What exactly do you need help with? Here's a tutorial on file uploading:

http://www.w3schools.com/PHP/php_file_upload.asp

Re: problem with creating folder and upload file in IIS7

Posted: Sun May 16, 2010 12:51 am
by mzarei
i knew exactly how should i upload file in php
my code also work perfect in my localhost
but when i try it in website then it can't make the folder so uploading file became get fail

i think we cannot use chmod in IIS !
below is a part that not working in website

$userdir = $user_id ;
$upload_dir = "uploads/{$userdir}/";
if (!is_dir("$upload_dir"))
{
mkdir($upload_dir ,0777);
chmod($upload_dir, 0777);
}
if (!is_writeable("$upload_dir")) {
die ("Error: The directory <b>($upload_dir)</b> is NOT writable, Please CHMOD (777)");
}

always when i try to upload i see " Error: The directory (uploads/1/) is NOT writable, Please CHMOD (777) " error

in (uploads/1/) -1- is my user id :wink:

now what should i do ?

Re: problem with creating folder and upload file in IIS7

Posted: Mon May 17, 2010 4:02 am
by iqbalmp
Ask your server admin for write permission on upload/ folder. The 0777 will not work with windows servers as well.

Re: problem with creating folder and upload file in IIS7

Posted: Mon May 17, 2010 4:11 am
by mzarei
I asked them , and they told me already it has write permission

but this type of code correct ?
$upload_dir = "uploads/{$userdir}/";
or it must be like this :
$upload_dir = "uploads//{$userdir}//";
or complete address like this :
c:\domains\<my username>\<my domain name>\wwwroot\upploads\{$userdir}
or ... ?

still it's not working ...
but i install front page in website and now i can upload in /_private/ folder ... but funny things is i with my control panel file manager i can not see the files ... !!!
then where is the files ? also i can download the files from /_private/ folder but can't see file with ftp program and file manager