This topic is locked

Allow only format .doc and .pdf to upload

6/21/2007 12:58:56 PM
PHPRunner General questions
D
diego author

Olá
Is it possible to allow only format .doc and .pdf for uploads?

I have tested javascript to this and return a smarty error

It´s on phprunner 4.0 build (265)

Please help me

Thank´s

J
Jane 6/22/2007

Diego,
you can put this checking into generated include\commonfunctions.php file.

Find this line there:

$file_move = array($file['tmp_name'],GetUploadFolder($field).$value);


and put your checking just after.

Here is the sample code:

if($file["size"]>2048*1024)

return false;

$ext = substr($file["name"], strlen($file["name"])-4);

$ext=strtoupper($ext);

if($ext!=".DOC" && $ext!=".PFD")

return false;


Or you can add your JavaScript code on the Visual Editor tab -->HTML mode. You only need to enclose your code in the {literal} and {/literal} tags:

...

{literal}<script>

//your javascript code

</script>{/literal}

...

D
diego author 6/26/2007

Ok it´s prevent upload others extensions

I realy need to send a messagen to screeen information of allowed extensions and register not insert in batabase

in your code attach is ignored, resgister inserted

I need alert on screen before insert register

only attach .doc and .pdf is register inserted
Thank´s

Bad english i from brazil.