Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Stripping extensions and making a directory...

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Stripping extensions and making a directory...

Postby nindoja » Wed Jun 25, 2003 5:48 pm

Hello. How would I take the name of an uploaded file (variable is $file), and remove the extension (either .8xp or .zip)??? Also, how would I take that new variable, and make a directory with that new name??? Thanks.
nindoja
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Jan 08, 2003 4:45 pm

Postby Redcircle » Wed Jun 25, 2003 5:57 pm

there are several way you can do that. an easy way that I do it is to explode the name by '.' and use mkdir() to create a new directory.

Code: Select all
$filename_array = explode('.',$filename);
$directory_name = $filename_array[0];
mkdir($directory_name);
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Thanks.

Postby nindoja » Thu Jun 26, 2003 8:33 am

Thanks. That worked.
nindoja
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Jan 08, 2003 4:45 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron