ok.... if you can capture form information, you already know how to do it. im not sure that any way someone would explain it will help you.... especially if you're gonna get funny about it!
anyway.
all you need to know is this.
- to make a form which uploads a file, you need to include 'enctype="multipart/form-data"' on the form tag, and have an input of type 'file'.
- when you upload from a html form, it puts the file information into an array called $_FILES.
- a helpful php function is move(from,to); there are more.
so youd say (pseudo code)
if (formhasbeensubmitted){
$newfilename = "foo.bar";
$thepath = "/your/path/here";
if (move($_FILES["file_field_name_from_html_form"]["tmp_name"],$thepath."/".$newfilename)){
insert '$newfilename' into database
};
};
thats it.
the php website tells you everything else you need to know about what is included in the $_FILES array.
(copied + pasted from php.net)
[INDENT]The contents of $_FILES from the example form is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. This can be any name.
$_FILES['userfile']['name']
The original name of the file on the client machine.
$_FILES['userfile']['type']
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
$_FILES['userfile']['size']
The size, in bytes, of the uploaded file.
$_FILES['userfile']['tmp_name']
The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES['userfile']['error']
The error code associated with this file upload. This element was added in PHP 4.2.0 [/INDENT]
it isnt hard, if you think about it. if.