Hi and thanks again for replying,
I started playing with the one you made to see If I can make it work the way I want to, but the PHP file named vars.php where you define the variables you have the following:
$maxImageSize = "512000";
to set the highest size of the image to be uploaded, then what command do I need for a pdf file? Do I have to use
$maxApplicationSize
or there's an specific one for a .pdf file?
Also, why do you have these 2 roots in the same program:
$file_dir = "/home/paul/public_html/FREE/upload/images";
$file_url = "http://localhost/~paul/FREE/upload/images";
And if I want to tell the program the type of file accepted the way you are doing it with the image here
$acceptedImageType[] = "x-bmp";
Is there also an specific one for .pdf files?
Weedpacket;11041011 wrote:You can use [man]finfo_file[/man] to get information about the type of a file (e.g. "application/pdf"). Basically it would check that the first line is [font=monospace]%PDF-1.n[/font], where [font=monospace]n[/font] varies depending on which version of PDF the document is using.
Another check that can be made is that the last line of a properly-formatted PDF file is [font=monospace]%%EOF[/font], and the line before that gives the number of bytes in the body of the document (so it should be a little less than the size of the entire file). Checking those would be a matter of reading the file line-by-line, keeping the last two lines, and checking those two lines' contents.