Current location: Hot Scripts Forums » Programming Languages » PHP » i have a file upload issue....


i have a file upload issue....

Reply
  #1 (permalink)  
Old 11-23-05, 09:58 PM
stormshadow's Avatar
stormshadow stormshadow is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
Question i have a file upload issue....

okay i am in the making of a file upload script for my game so they can upload thier own custom pic... see the problem is i wanted it to go to members/"thierid"/whatever.png but idk how to add thier id as a folder...
Thanks in advance,
Storm Shadow

P.S. If you wish to see my game (so far) go to www.lost-on-earth.net
Reply With Quote
  #2 (permalink)  
Old 11-24-05, 12:31 AM
e4c5 e4c5 is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
When this problem is re examined, you will see that it's not really an upload issue, it's a matter of creating directories on the server. As such all you need is to figure out the userId from the session information and to create a directory on the server to match that. You can also make use of the file_exists() call to find out if the directory is already present.

--
Javascript file upload?
Reply With Quote
  #3 (permalink)  
Old 11-24-05, 02:12 AM
Ligx Ligx is offline
Newbie Coder
 
Join Date: Nov 2005
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
mkdir()

you could use
<?PHP
mkdir("your_dir", 0755);
?>


in your case it would maybe be;
<?PHP mkdir("members/$memberid", 0755); ?>

OR

<?PHP
$memberid = @$HTTP_SESSION_VARS["id"];
mkdir("members/$memberid", 0755);
?>
Reply With Quote
  #4 (permalink)  
Old 11-29-05, 07:23 PM
stormshadow's Avatar
stormshadow stormshadow is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you!

Also I need to know a few more things on this topic... y did u use the numbers "0755"? and for the "file_exists() call" how do i use that?

Please reply and thank you in advance :-)
Reply With Quote
  #5 (permalink)  
Old 11-29-05, 08:02 PM
Christian's Avatar
Christian Christian is offline
Community VIP
 
Join Date: Mar 2005
Location: ProgrammingTalk
Posts: 2,449
Thanks: 0
Thanked 6 Times in 5 Posts
Quote:
Originally Posted by stormshadow
y did u use the numbers "0755"?
The numbers are chmod, basically chmod refers to setting the access privledges for a file. You you can do a quick search for more infomation about chmod.
Quote:
Originally Posted by stormshadow
and for the "file_exists() call" how do i use that?
PHP Code:

<?php

$filename 
'/path/to/foo.txt';

if (
file_exists($filename)) {
   echo 
"The file $filename exists";
} else {
   echo 
"The file $filename does not exist";
}
?>
Reply With Quote
  #6 (permalink)  
Old 12-03-05, 09:57 PM
stormshadow's Avatar
stormshadow stormshadow is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 355
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks dude
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Upload as Easy as Drag And Drop. e4c5 General Advertisements 0 11-09-05 09:00 AM
ASP upload prob minority ASP 1 06-27-05 08:35 AM
file upload csmaster2005 PHP 1 06-16-04 06:57 PM
Upload Script Problem!!! seanknighton Perl 0 03-21-04 09:54 PM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM


All times are GMT -5. The time now is 06:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.