Copy link to clipboard
Copied
I am created an online form using Dreamweaver CS5.
I have the form created, and the last item within the form is a FILE FIELD, which will enable people to send/attach a photo with their online form submission.
Adding the file field is obviously as simple as clicking on a button within Dreamweaver, but I would like to limit the FILE SIZE that people are allowed to send to 1 Megabyte.
How do I do that within Dreamweaver?
I have read that adding this line within a PHP form created from scratch does it.... but as I am not creating a PHP form from scratch (as in all hand coded without help from Dreamweaver) is there a way around it?
$max_file_size = 10000;
Thank you all in advance for any help or advice.
Copy link to clipboard
Copied
Adding a file is completely controlled by php (or another server sided scripting language) and cannot be done with built in DW features alone. You will also need to limit the file types to keep program files from being uploaded and executed (ie. viruses) and protect yourself from spammers.
I suggest the formmail script available at http://www.tectite.com
It has spam protection and also allows for file uploads and conditional modifiers to lock out bad file types.
Copy link to clipboard
Copied
Moved to the Developing server-side applications in Dreamweaver forum.
To limit the maximum size of a file being uploaded by PHP, you need to add a hidden form field before the file input field. Set the name to MAX_FILE_SIZE (it's case-sensitive), and the value to the maximum size measured in bytes.
<input type="hidden" name="MAX_FILE_SIZE" value="1048576">
<input type="file" name="upload">
See http://www.php.net/manual/en/features.file-upload.post-method.php.
Copy link to clipboard
Copied
Thank you David for that, I will look into that asap.