File Upload
File upload fields are fields that allow users to send you files. The files are uploaded to a directory on your server, which you can specify by yourself. You can add file uploads to your form by creating fields of type "File Upload".
The File Upload Control
The file upload control consists of a button, which can be used in order to select the file, which you want to upload, on your local machine and a section where the file name of the selected file is displayed, after it was selected, using the button
No translation for the button text
The file upload control is completely created by your browser and can have a different look on different browsers. The button text comes from your browser as well. Therefore you cannot modify or translate the button text on multi language websites. The button text will always be in the browser language (which is determined by the operating system of your computer or your browser) and cannot be changed by Visforms. Nevertheless, as the browser language is usually the language the user prefers, the button text will be fine.
The control value cannot be set programmatically
Another specialty of the file upload control is, that it's value cannot be set programmatically but only through the use of the upload button. The reason is, that, in order to upload a file, the browser has to do a lot of work and store information, which is only triggered by the use of the upload button, because each browser has it's own internal working. Therefore, if a user has submitted the form, but the server side validation of the user inputs fails and the form is displayed again, user inputs made in upload fields are lost and the user has to select the file, which they want to upload manually again.
Uploaded files are submitted with the post
The process of uploading a file from a local computer to the server consist of several steps. First the browser is responsible for submitting the binary file information to the server with the post. The server will extract the file information and stores them in a temporary file. Visforms will then decide what to do with the temporary file. It will first validate file size and extension and check according to the Joomla! standards, that the file is not harmful. If everything is ok, Visforms will rename the file and store it at it's final destination.
Uploading files can fail due to restictive php settings of your server
There are php settings which control which overall amount of data can be submitted with the post at a time, how big a single upload file can be, how many inputs can be submitted with the post at a time and so on. The settings are made in the php.ini. If submitted data does not meet this settings (files are to big, to many...), you will run into problems, for which Visforms is not responsible in the first place. Especially, it the overall request content is to big, then all user inputs will be lost und the post will be empty. As a result it is, for example, not possible to display inputs, which the user has already made, again, when the form is displayed again (because server side validation of the data fail). The security token, which is submitted with the post, will also be missing, so that most probably the result of the submit is, that an error message "Invalide Token" is displayed.
The following php.ini settings are especially of interest:
- upload_max_filesize: Determines the maximum file size of an individual file, that is uploaded with the form
- post_max_size: Determines the maximum total size of the post. This includes all uploaded files plus all other data that are submitted with the form (field names, user inputs...)
You must adapt the form configuration settings to the server's php settings
Settings made in the php.ini prevail over all settings which you make in the form configuration. So even if you set the allowed file size in the form configuration to 5MB, but your php.ini only allows 4MB, trying to upload files with more than 4MB file size will result in errors. Please make sure, that your form settings are adequat with regards to what your php.ini allows.
Where can I learn about the values set in the php.ini?
Information about the php settings of your server are available in the administration of your webseite in the main menu item System -> System Informationen on the tab "PHPInformationen".
Adapt server setting
Many provider allow their customer to override some settings made in the php.ini. How this is done, differs from provider to provider. So please contact your provider if you want to adapt some server settings or check out their documentations.