• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to LIMIT the file size sent on my FILE FIELD?

Guest
Oct 15, 2012 Oct 15, 2012

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.

TOPICS
Server side applications

Views

802

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2012 Oct 15, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2012 Oct 15, 2012

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 19, 2012 Oct 19, 2012

Copy link to clipboard

Copied

LATEST

Thank you David for that, I will look into that asap.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines