Tag Archives: upload
How to upload multiple files using PHP and HTTP Post
We can implement this in two ways. One as an array of files and the other as individual variables. Method 1: In the html form, set multiple file input boxes, use the array name as their names, as follows: <form … Continue reading
File upload related settings in php.ini
There are a few settings in the PHP configuration file (php.ini) related to file uploading: file_uploads = On/Off – Whether or not to allow HTTP file uploads. upload_tmp_dir = directory – The temporary directory used for storing files when doing … Continue reading
Upload and store files in Mysql using PHP : Part 2 – PHP file processing
To store uploaded files to MySQL database, you can use the normal INSERT statement as shown in the php example listed below: <?php $con = mysql_connect("localhost", "", ""); mysql_select_db("w3m"); $error = $_FILES[’w3img’][’error’]; $tmp_name = $_FILES[’w3img’][’tmp_name’]; $size = $_FILES[’w3img’][’size’]; $name = … Continue reading
Upload and store files in Mysql using PHP : Part 1 – Design MySql Table
A MySQL database can be used to store files uploaded using PHP.The table columns must be created using BLOB columns to hold the binary file.The blob column can hold up to 65,535 characters. Example code: <?php $con = mysql_connect("localhost", "", … Continue reading
Check for empty files in http upload using PHP
Bad upload process could result in empty files and developers need to check for empty files before using them, because the PHP engine could give no error. For example, if a user typed a bad file name in the upload … Continue reading
Detect http file upload errors in PHP
Errors that occur during file upload create an error code in $_FILES[$field]['error']. Possible error code values are: UPLOAD_ERR_OK (0) – There is no error, the file uploaded with success. UPLOAD_ERR_INI_SIZE (1) – The uploaded file exceeds the upload_max_filesize directive in … Continue reading
Move uploaded files to a different directory using PHP
PHP stores uploaded files in a temporary directory with temporary file names. It is a good practise to move uploaded files to a permanent directory, if you want to keep them permanently. The move_uploaded_file() function can be used to move … Continue reading
Retrieve uploaded file information using PHP
When a file upload form posts the file to a Web server, the called PHP script specified in the form action attribute is used to process the file. This receiving PHP script can get the uploaded file information through the … Continue reading
using FORM tag appropriately for uploading files
The files specified in the will be transferred from the browser to the Web server by using a HTTP Post. This transferring (uploading) process is controlled by a properly written tag. Example: <FORM ACTION=receiving.php METHOD=post ENCTYPE=multipart/form-data> The METHOD must be … Continue reading
File Upload dialog using PHP and HTML
File upload allows visitors to specify a file on the browser’s system and submit it to the Web server. This is a useful feature for interactive Web sites. To present an input field on your Web page to allow users … Continue reading