Blog

File uploads on your website: receiving client documents and reducing risks

GazduireOnline.ro yazarı
Yayınlayan
GazduireOnline.ro PR

Bu içerik yalnızca Rumence ve İngilizce olarak mevcuttur; aşağıda İngilizce metin gösterilmektedir.

File uploads on your website: receiving client documents and reducing risks

A quote request form that accepts photographs or documents can reduce the back-and-forth with a client. However, website file uploads also create another route for malicious content, personal data and uncontrolled storage use. A photograph of a damaged part might be enough for an estimate; a copy of the client's identity document has no place in the same enquiry.

Before accepting client documents, decide what you need, how files will be checked, who can access them and when they will be deleted.

Ask only for necessary files and explain the limits

Start with the purpose of the form rather than everything the technology allows. A workshop might need photographs of an item, while a print business might require a PDF to prepare a quote. If a written description is enough, make the attachment optional.

  • Define an explicit list of accepted formats, such as JPEG, PNG and PDF.
  • Set a maximum size per file, a maximum file count and a total upload allowance.
  • Avoid archives, executable files and macro-enabled documents unless there is a justified business requirement.
  • Display the rules before file selection, not just after an error.

An initial configuration might allow three files of up to 5 MB each, with a combined file allowance of 15 MB. These are examples: adjust them to your actual documents and available resources.

Help text beside the field could say: „Attach up to 3 PDF, JPG or PNG files, no larger than 5 MB each. Do not send identity documents or banking details.” For photographs, suggest cropping out irrelevant information, such as an address visible on a parcel.

Validate files on the server before making them available

A browser's file picker helps people choose an appropriate file, but its restrictions can be bypassed. Uploaded file security requires server-side validation of every request, including requests sent directly without using the form.

Check the permitted extension, the content type detected on the server and the file's structure using tools appropriate to its format. Do not rely solely on the MIME type supplied by the browser. Renaming an executable as a PDF does not make it safe, and a valid file signature does not rule out malicious content.

  • Enforce size and file count limits on the server too.
  • Generate a random internal filename; never use the supplied name as a storage path.
  • Keep uploads in quarantine until checks have finished.
  • Use malware scanning where your infrastructure supports it, without treating a clean result as a guarantee.
  • Keep libraries used for images, PDFs and previews up to date.

For example, if a PDF fails validation or the scanning service is unavailable, do not automatically release the document. Keep it pending or reject it in a controlled way. Re-encoding images with an up-to-date library may remove some unwanted structures, but it does not replace the other checks.

Keep documents private and restrict access

A hard-to-guess URL is not an authorisation rule. Store documents outside the website's public directory or in storage explicitly configured as private. Prevent uploaded files from executing and disable directory listings.

Downloads should pass through identity and document permission checks. If you provide temporary links, limit their lifetime and treat them as confidential: someone who obtains such a link may gain access.

For example, in a refurbishment business, the person preparing a quote may need access to a client's plans. A contractor who manages blog articles should not automatically receive the same permission.

  • Grant access only to roles that need the documents.
  • Protect internal accounts with unique passwords and multi-factor authentication where available.
  • Use HTTPS for both the form and downloads.
  • Log relevant access events without copying document contents into logs.

Notify the team with a link to the protected area rather than attaching another copy to every email. Configure downloads to be served as attachments and prevent browsers from guessing a different content type.

Choose a retention period before launch

Receiving client documents also means deciding when to delete them. Regulation (EU) 2016/679, commonly known as the GDPR, requires data minimisation and storage limitation when you process personal data. An appropriate retention period depends on the purpose, applicable obligations and any justified need to retain the information.

For example, you might arrange automatic deletion of files from an unsuccessful enquiry 30 days after that enquiry is closed, if your assessment supports this period. This is an operational example, not a universal legal deadline.

Separate documents needed for an accepted order from material used only for an estimate. Your privacy information should explain the purpose of collection, the legal basis, recipients and the retention period or the criteria used to determine it.

Include temporary copies, thumbnails and exports in your procedure. For backups, document the expiry cycle and how you prevent deleted documents from being reintroduced after a restoration. Periodically check that scheduled deletion actually runs.

Troubleshoot failed uploads without exposing data

With attachment forms, failures can originate in the browser, the application or the infrastructure receiving the request. Use dummy files for testing rather than genuine client documents.

  1. Try a small, permitted file. If it works, compare its size and format with those of the rejected file.
  2. Check the total request limit in the application, web server and any proxy. It must accommodate form data as well as the files themselves.
  3. For PHP applications, check upload and request limits, the temporary directory and the permitted number of files.
  4. Check available storage, account quotas and permissions for both temporary and destination directories.
  5. Investigate session expiry, cross-site request forgery protection, processing timeouts and filtering rules.
  6. Use the request time and identifier to find relevant logs; do not log the document's contents.

An HTTP 413 response usually indicates that the request is too large. Do not immediately increase every limit: first check whether the document complies with your upload policy. Show a useful message, such as „This file exceeds the 5 MB limit. Reduce its size and try again.”

Run a complete check before publishing the form

Before launch, test a valid file, an oversized file, a file with a prohibited extension and an access attempt from an account without permission. Confirm that a document cannot be accessed before validation and that deletion also removes its previews. Apply request rate limits to help reduce abuse.

For your infrastructure, consider GazduireOnline.ro's web hosting or WordPress hosting services, depending on your application. Use the contact form to describe expected upload volumes, file sizes and processing requirements so you can discuss a suitable configuration.

Publish the form only once someone is responsible for reviewing enquiries and monitoring upload errors and deletions. A straightforward process that collects fewer necessary documents and assigns clear responsibilities is easier to manage and audit.

Sitenizi başlatmaya hazır mısınız?

İstediğiniz alan adının boşta olup olmadığını kontrol edin veya size uygun hosting paketini 10 saniyede öğrenin.

BENZER MAKALELER

İşinize yarayabilecek diğer makaleler. Okurlarımız için güncel ve pratik bilgiler yayınlıyoruz.

BÜLTENİMİZE ABONE OLUN

Bültenimize ve pazarlama iletişimlerimize abone olun. Size yenilikleri ve kampanyaları göndereceğiz.

Bülten aboneliği illüstrasyonu