Skip to content Skip to sidebar Skip to footer

Check The Content Of File Before Upload

I have to check the Content of a zip/rar file before uploading to the server. Let me explain the scenario. There are 2 types of users in my web project: 1: Normal Registered user 2

Solution 1:

You won't be able to check this client side unless, of course, you had some kind of plugin (for all browsers) that did the checking/uploading for you. You'll have to handle this on the server side.

Also, Admins can upload viruses just as easily as non-admins. Some user's don't even know their machine has more viruses than a shanty-town brothel.

EDIT: Also, how is the user going to execute their PHP file on your server before you've checked it unless you run that php file? This sounds like a recipe for disaster anyway. All it will take is for something to slip through the cracks and a malicious user will destroy your site. Allowing normal people to upload executable script to your server is asking for serious trouble.

Solution 2:

Unpack it in directory, which can't be reached through the web, check, then move back to web-folder, where it should be.

Assuming that you have your website in directory /var/www/website and user content goes to /var/www/website/user and is reachable through www.website.com/user/ :

Create temporary dir in /tmp unpack there, check, move to /var/www/website/user

If you don't have access to /tmp, you can create /var/www/website/tmp and prohibit access to it using your server settings

Solution 3:

you can create a folder for putting the zip file and unzip.

and disable the php execute for the folder. that can solve your problem

Post a Comment for "Check The Content Of File Before Upload"