need help with my phpupload script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Fri Jul 25, 2003 10:04 am

surely calling the select $directory as well will effectively overwrite the input text with ""

try naming the text field name="make_directory"

then

Code: Select all

$dir = $_POST['directory'];
if($_POST['make_directory'] !== "")
 {
 mkdir('./projects/' .$_POST['make_directory'],0755);
 $dir = $_POST['make_directory'];
 }

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Fri Jul 25, 2003 1:12 pm

so you named the form fields differently?

I presume you've tried echoing the $_POST variables to check they exist?

do a

var_dump($_POST);

you should have a value for 'make_directory' if you typed anything, or a value for 'directory' if you selected something

pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Post by pootergeist » Sat Jul 26, 2003 2:19 am

ok - my codes use reg_globals OFF (which is default since php4.2) - yours use the older approach of accessing post/file/get etc variables through the global scope - eg $varname rather than $_POST['varname'];

either recode the bit I did to use the older method (which undoubtedly will have to be updated as soon as your host switches reg_globals off)

or update all your code bits to access the variables through the $_FILES or $_POST array scopes.
Read this [age to learn how to access the files array variables.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests