Category: php

DataValidator: is_date () method

Hi guys! Continuing our series of posts on the DataValidator class , today we are going to address the is_date () method , which, as the name says, is a function for validating fields of type Data (or Date if you prefer) .

The method is very flexible because it allows the validation of both instances of the DateTime class and a date (including time) in a specific format defined by the user.See a validation using an instance of the DateTime class.

Continue lendo

DataValidator: contains() method

In the last post I presented to you a class for data validation that I implemented and made available through my link on GitHub for the whole php community to be able to use, guess and why not contribute.

Well then. From this post and in future posts I will address some of the validation methods that I think are important and that it is interesting to emphasize the techniques for a better use of them.

Continue lendo

DataValidator – php class to validate data

Whenever I was involved in a php project, I felt that something that was really efficient to do any kind of data validation was missing Something that was effectively tested and approved and that allowed me to reuse code and mainly, that was adaptable to any type of system.

It was with this in mind that I took the free hours of last December to implement a data validation class (which I called DataValidator ). And to help the development community around the world, I’m making it available on GitHub ( https://github.com/rafaelwendel/DataValidator ).

Continue lendo

PHP function to find out the size of a file

Hello people! A few weeks ago I was developing a system where the client requested that in addition to its institutional website it also had a restricted area where he could make digital documents available to his clients. In short, each customer would have a virtual space with documents and other important files and access everything with their username / password.

Well then. When the system is accessed, all files that are available to the user are listed for that user. And this list shows the name of the document, its format, the date of submission, a brief description of what it is about and the size of the file since, obviously, the customer has the option to download it.

Continue lendo

Upload files with jquery and progress bar

Hey guys, how are you? In today’s post we will see a very cool way to put a nice file upload form with progress bar using AJAX (JQuery).

To follow the post, I recommend reading this post , which is where I approach a php function to upload files safely and simply. It is this function that I will use in today’s example.To get started, download JQuery and the JQuery.Form plugin . That done, our directory and file structure should look like this:

Continue lendo