Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-14-2004, 10:35 AM   PM User | #1
romram
New Coder

 
Join Date: Apr 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
romram is an unknown quantity at this point
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?????
romram is offline   Reply With Quote
Old 04-14-2004, 11:42 AM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Slashes are the wrong way. You need forward slashes
PHP Code:
$dir "/instructor/" $username
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 04-14-2004, 12:09 PM   PM User | #3
romram
New Coder

 
Join Date: Apr 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
romram is an unknown quantity at this point
I tried it but it didn't work!
romram is offline   Reply With Quote
Old 04-14-2004, 12:30 PM   PM User | #4
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Is the instructer directory chmodded to 777?
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 04-14-2004, 01:32 PM   PM User | #5
romram
New Coder

 
Join Date: Apr 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
romram is an unknown quantity at this point
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);
romram is offline   Reply With Quote
Old 04-14-2004, 01:36 PM   PM User | #6
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
PHP Code:
$assig $_GET['assig'];
$username strtolower($_SESSION["loginUsername"]);
$destination=  "instructor/" $username "/"$assig "/";
copy($_FILES['uploadedFile']['tmp_name'],$destination); 
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 04-14-2004, 01:42 PM   PM User | #7
romram
New Coder

 
Join Date: Apr 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
romram is an unknown quantity at this point
I tried your answer and I print the path and this is what I got
"instructor/100/$assigTitle/ "
romram is offline   Reply With Quote
Old 04-14-2004, 04:10 PM   PM User | #8
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
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 
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks

Last edited by Nightfire; 04-14-2004 at 04:12 PM..
Nightfire is offline   Reply With Quote
Old 04-15-2004, 03:14 PM   PM User | #9
romram
New Coder

 
Join Date: Apr 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
romram is an unknown quantity at this point
Thankyou the problem is solved now
romram is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:35 AM.


Advertisement
Log in to turn off these ads.