Storing file uploads

This page will show you how to have a file uploads stored on the server, you will be sent a link to the file in the notification email.

Step 1

Follow the steps on the File uploads page to add a File Upload element to the form and configure it.

Step 2

Enable and configure file upload storage. In process.php search for the term $config['saveUploads'] and set it to true. Also check the setting below $config['uploadPath'], by default this will save the uploads into the quform/uploads/ folder, you should make sure that this folder is writable by the web server user, this may require setting permissions 0777 on the folder (you can use FTP software to do that).

Changing the upload save path per element

You can have a different file upload path for each element. To do that use the code below after you have created your element in process.php.

1
$upload->setSavePath(QUFORM_ROOT . '/folder');
$upload->setSavePath(QUFORM_ROOT . '/folder');

The above will set the save path to the directory quform/folder/. If you want the path to be outside the quform folder then you should enter the path to the folder you want to save the files to. For example:

1
$upload->setSavePath('/home/user340349/web/public_html/files');
$upload->setSavePath('/home/user340349/web/public_html/files');

Preventing the file from being uploaded

By default, if saving to the server is enabled then all uploaded files will be saved to the server. If you want to disable a file upload element from saving the uploaded files to the server, use the code after you have created the element in process.php.

1
$upload->setSave(false);
$upload->setSave(false);
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy