Code For file uploading to work, it must be turned on in your php ini file. And the upload _tmp_dir must be set; in other words the upload directory must exist. Below is an extract from a php ini file: ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system ; specified). upload_tmp_dir = C:PHPuploadtemp ; temporary directory for ; Maximum allowed size for uploaded files. upload_max_filesize = 2M *****End php.ini file***** Here you can see that all the necessary settings are made. Once you've made all the necessary changes to your php settings, let's create the form needed to do the uploads. To enable a form to handle uploads, you need to change three things on a standard form.
Fig1. Upload form example PHP fills a $_FILES[''] array with information about the file that you upload. The array contains the following info: Name - name of the file as it was on the local disk. Type - mime type of the file (example image/gif). Size - file size. Tmp_name- name of the file as it is stored in the final destination. Error - error code for when something goes wrong.
blog comments powered by Disqus |
|
|
|
|
|
|
|