Hi,
I am new to php and coding in general. PHP-5.1 on Centos-5.3
My goal, to allow users to create new directories and then upload files to these newly created directories. I have .htaccess protected the web page which a specific group of users will use to access the directories/data.
My index.html file -- works fine
Test
<form enctype="multipart/form-data" action="chdir.php" method=POST>
<Create a directory: <input type="text" input name="directory" /><br />
<input type="submit" value="Make Directory" />
</form>
Calls chdir.php -- attached--- which allows me to create a directory and cd to the newly created directory. Works fine, I print out current working dir and it is the newly created dir.
Then within chdir.php, I call the script upload.php to upload the files. (also attached: upload.php).
I have declared a variable in chdir.php $newdir which is the newly created dir that I would like to upload my files to. However, my upload.php script does not recognize the $newdir variable...
Error message: PHP Notice: Undefined variable: newdir in /data/www/html/mef/upload.php on line 3, referer: http://kaya1/mef/chdir.php
I did have the upload.php script working properly as I had the $target hard coded to a specific dir: $target = data/ and the files would go to data/<filename>.. but I would like the files to be uploaded to:
data/$newdir/<filename>
could it be a variable scope issue... or there is probably an easier way to tell the upload.php script which dir to upload to.
had to rename files in order to attach... but the code refers to original names
chdir.php --> chdir.txt
upload.php --> upload.txt
Any help or information appreciated.
Thanks
mef