|
ugojamali (m)
|
Are you talking about uploading images or inserting them in the form like the logo we see at the header of an application form? A web based form cannot contain a picture unless it is a form that has to be printed out and resubmitted by your intended users. other than that a web based form can only contain nothing but form fields. If you are talking about users being able to upload their pictures with the form then i can help you with that.
First, write your HTML form. In the form include a FILE UPLOAD button by writing the following code within your form:
<input type="file" name="fileField" id="fileField" />
Be sure your form has attribute enctype="multipart/form-data" otherwise the file upload will not work.
Now write the PHP for the upload:
<?php
$uploaddir = '/var/www/uploads/'; $uploadfile = $uploaddir . basename($_FILES['fileField']['name']);
echo '<pre>'; if (move_uploaded_file($_FILES['fileField']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "The file could not be uploaded!\n"; }
echo 'Here is some more debugging info:'; print_r($_FILES);
print "</pre>";
?>
The above script will upload the file with the form. I'm assuming you know how to submit your form to the database. If you require more help please indicate.
Ugo
|