PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 22nd, 2003, 02:59 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Send a message via AIM to thecharking
create new folder with php

I have a file upload script that works [finally] but want to have users submit pics into a folder, which I want to be created as the users name. I was thinking I could just maybe submit the file and then it would jsut create it, but it didn't, so how can I do this? This is my script:

PHP Code:
<?php
// Configuration part 
$dbhost "localhost"// Database host 
$dbname "users"// Database name 
$dbuser "dbuser"// Database username 
$dbpass ""// Database password 

// Connect to database 
$db mysql_connect($dbhost$dbuser$dbpass) or die("Error: Couldn't connect to database"); 
mysql_select_db($dbname$db) or die("Error: Couldn't select database."); 

if(
$IsLoggedIn)
$userid $_GET["userid"];
    if(
$_POST['Submit'])
        {

            if(
$userid)
            { 
$uploadName mysql_query("SELECT * FROM users WHERE userId ='"
                             
$userid "'");
            while (
$upName mysql_fetch_row($uploadName))
                { 
$userName2 $upName[1];
                   
$userPic1 $upName[11]; 
                   echo 
"$userName2"; } }
                
//If the Submitbutton was pressed do: 

            
if ($_FILES['imagefile']['type'] == 'image/pjpeg')
                { 

//this is where the pic is put into a folder by the username
    
copy ($_FILES['imagefile']['tmp_name'], 
    
"pics/profiles/" $userName2 "/" $_FILES['imagefile']['name']) 
    or die (
"Could not copy"); 

        echo 
""
        echo 
"Name: ".$_FILES['imagefile']['name'].""
        echo 
"Size: ".$_FILES['imagefile']['size'].""
        echo 
"Type: ".$_FILES['imagefile']['type'].""
        echo 
"Copy Done...."
        } 


        else { 
            echo 
""
            echo 
"Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"
        } 


?>
<form name="form1" method="post" action="index.php?page=classupload&userid=<?php echo "$userid"?>" enctype="multipart/form-data"> 
<input type="file" name="imagefile"> 

<input type="submit" name="Submit" value="Submit"> 
</form>
<?php } else { ?>How did you get here? You aren't <a href="index.php?page=login">Logged In</a>.
<?php ?>

is there any way to do this? Maybe even when the user is made? thanks!
__________________
hey it's the CHARKING

Reply With Quote
  #2  
Old June 22nd, 2003, 03:56 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Send a message via AIM to thecharking
nevermind yay!

i figured it out

anyone interested

lookup mkdir

Reply With Quote
  #3  
Old June 23rd, 2003, 05:49 PM
AmericanD AmericanD is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 81 AmericanD User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
u getting smarter day by day man
__________________
Hungry for Code

Programming works best with a team over one single person

Reply With Quote
  #4  
Old June 24th, 2003, 05:10 AM
thecharking thecharking is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 187 thecharking User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Send a message via AIM to thecharking
haha

yeah well I do what i can. i know i left sort of an empty psot up there, but, I thought... I don't know... I couldn't find much on mkdir() for a while... anyway... heh... yah

Reply With Quote
  #5  
Old November 6th, 2007, 12:19 AM
kaka kaka is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 2 kaka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 32 sec
Reputation Power: 0
about uploading file in separate user directory?

Dear thecharking
if u get your solution to problem shown bellow then please provide it to me also . I also have same problem.


"I have a file upload script that works [finally] but want to have users submit pics into a folder, which I want to be created as the users name. I was thinking I could just maybe submit the file and then it would jsut create it, but it didn't, so how can I do this? This is my script:

PHP Code:
<?php
// Configuration part 
$dbhost "localhost"// Database host 
$dbname "users"// Database name 
$dbuser "dbuser"// Database username 
$dbpass ""// Database password 

// Connect to database 
$db mysql_connect($dbhost$dbuser$dbpass) or die("Error: Couldn't connect to database"); 
mysql_select_db($dbname$db) or die("Error: Couldn't select database."); 

if(
$IsLoggedIn)
$userid $_GET["userid"];
    if(
$_POST['Submit'])
        {

            if(
$userid)
            { 
$uploadName mysql_query("SELECT * FROM users WHERE userId ='"
                             
$userid "'");
            while (
$upName mysql_fetch_row($uploadName))
                { 
$userName2 $upName[1];
                   
$userPic1 $upName[11]; 
                   echo 
"$userName2"; } }
                
//If the Submitbutton was pressed do: 

            
if ($_FILES['imagefile']['type'] == 'image/pjpeg')
                { 

//this is where the pic is put into a folder by the username
    
copy ($_FILES['imagefile']['tmp_name'], 
    
"pics/profiles/" $userName2 "/" $_FILES['imagefile']['name']) 
    or die (
"Could not copy"); 

        echo 
""
        echo 
"Name: ".$_FILES['imagefile']['name'].""
        echo 
"Size: ".$_FILES['imagefile']['size'].""
        echo 
"Type: ".$_FILES['imagefile']['type'].""
        echo 
"Copy Done...."
        } 


        else { 
            echo 
""
            echo 
"Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"
        } 


?>
<form name="form1" method="post" action="index.php?page=classupload&userid=<?php echo "$userid"?>" enctype="multipart/form-data"> 
<input type="file" name="imagefile"> 

<input type="submit" name="Submit" value="Submit"> 
</form>
<?php } else { ?>How did you get here? You aren't <a href="index.php?page=login">Logged In</a>.
<?php ?>



is there any way to do this? Maybe even when the user is made? thanks![/QUOTE]

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > create new folder with php


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap