Forums

File Upload check file name and content before uploading

ihkas 14 Sep, 2013
Hi

I have a quick question.
I am creating a form with joomla and chronoforms for my clients to upload some specific txt files.
i am using a couple of file upload boxes

I need certain checks on the file:
1. only .txt ( this i found built in the form ) so okay

but i also need to check 2 more things
1. file name starts with a specific string value
2. the text in the beginning of the file shd match something specific from the DB on my site )

if not files shd not get uploaded and user needs to be prompted accordingly

now i saw functions to read and verify text inside the file and through _FILES can access file name and check it but in case it is wrong how do i stop the file from being uploaded on my server side?
dont want to have it uploaded and then have to delete


thanks for your help
GreyHead 14 Sep, 2013
Hi ihkas,

how do i stop the file from being uploaded on my server side?

As far as I know you can't. You don't have any access to the files to check anything much until they have been uploaded.

Bob

PS I have read about some changes in HTML file handling that do allow some limited access but they will only work in the latest browser releases. This Wikipedia page has some links that might tell you more about this feature.
ihkas 17 Sep, 2013
thanks
This topic is locked and no more replies can be posted.