this is probably a total newbie question, but i can seem to figure it out.
when i run this code it gives me this error:
Undefined index: work in FILENAME on line 3... which is the file-to-be-uploaded name.
i copied this from php.net, so i thought it should work. then i copied the simpler code from w3 schools, and that gave me the same error. but, here is my html and php:
[HTML]<form action="process .php" method="POST">
Picture: <br>
<input type="hidden" name="MAX_FILE_ SIZE" value="25000" />
<input name="work" type="file" >
<br><br>
<input type="submit" value="Submit">[/HTML]
[PHP]<?php
$target_path = "/uploads/";
$target_path = $target_path. basename( $_FILES['work']['name']);
if(move_uploade d_file($_FILES['work']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['work']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>[/PHP]
thanks in advance to anyone who stoops to answer my easy question!
oh, also, it might help to know that i am using brinkster, and their php.ini file does not allow me to do many things (like send email). which sucks for me, since i obviously am not the most knowledgable in php. also, this is a page for someone else, so moving the website from brinkster to another server is not an option! :)
when i run this code it gives me this error:
Undefined index: work in FILENAME on line 3... which is the file-to-be-uploaded name.
i copied this from php.net, so i thought it should work. then i copied the simpler code from w3 schools, and that gave me the same error. but, here is my html and php:
[HTML]<form action="process .php" method="POST">
Picture: <br>
<input type="hidden" name="MAX_FILE_ SIZE" value="25000" />
<input name="work" type="file" >
<br><br>
<input type="submit" value="Submit">[/HTML]
[PHP]<?php
$target_path = "/uploads/";
$target_path = $target_path. basename( $_FILES['work']['name']);
if(move_uploade d_file($_FILES['work']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['work']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>[/PHP]
thanks in advance to anyone who stoops to answer my easy question!
oh, also, it might help to know that i am using brinkster, and their php.ini file does not allow me to do many things (like send email). which sucks for me, since i obviously am not the most knowledgable in php. also, this is a page for someone else, so moving the website from brinkster to another server is not an option! :)
Comment