Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts

    creating directory

    I had used the code below to create a directory:
    Code:
    $username = strtolower($_SESSION["loginUsername"]);
    $dir = "\\instructor\\" . $username;
    if(!file_exists($dir)
    mkdir($dir,0700);

    before adding "\\instructor\\" . to the $dir varible it was working,
    but because I want the folder to be created inside anothyer folder which is instructor folder I add this peice of code, but now it is not working..
    Do somebody know what is the problem?????

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Slashes are the wrong way. You need forward slashes
    PHP Code:
    $dir "/instructor/" $username

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried it but it didn't work!

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Is the instructer directory chmodded to 777?

  • #5
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thankyou I solved the problem, but now I am facing another one, maybe you can help

    I have page with name: ins_add_assig where I have a text field named "assigTitle" in the form tag I wrote the following:
    Code:
    <form name="form1" method="post" action="savefile.php?assig=$assigTitle" enctype="multipart/form-data">
    in the page savefile.php I have the following code:
    Code:
    $username = strtolower($_SESSION["loginUsername"]);
    $destination=  "instructor/" . $username . "/". $assig . "/";
    copy($HTTP_POST_FILES['uploadedFile']['tmp_name'],$destination);

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    PHP Code:
    $assig $_GET['assig'];
    $username strtolower($_SESSION["loginUsername"]);
    $destination=  "instructor/" $username "/"$assig "/";
    copy($_FILES['uploadedFile']['tmp_name'],$destination); 

  • #7
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I tried your answer and I print the path and this is what I got
    "instructor/100/$assigTitle/ "

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Change the form action to
    PHP Code:
    <form name="form1" method="post" action="savefile.php?assig=<?php echo $_POST['assigTitle'?>" enctype="multipart/form-data">
    Although I really don't see the point of you adding it to the url
    Just have savefile.php as the action and then use the below
    PHP Code:
    $assig $_POST['assigTitle'];
    //rest of your code here 
    Last edited by Nightfire; 04-14-2004 at 05:12 PM.

  • #9
    New Coder
    Join Date
    Apr 2004
    Posts
    79
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thankyou the problem is solved now


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •