Jump to content

How to upload image from a form into mysql including verification


anita999

Recommended Posts

Could someone please recommend an example of uploading an image (jpeg or gif) using a form and doing the PHP validation of the image and then inserting it into a mysql table as a blob.

 

I'm also interested in the validation part since I want to check whether a PHP script is inserted as part of the comments on the image and any other checks that can be performed to avoid insertion of the image into the DB in the case of a malicious image file.

 

Thanks in advance,

Anita

http://us2.php.net/manual/en/function.strpos.php might help for checking to see what type of file it is.

 

Also, http://us2.php.net/features.file-upload has a bit on type checking for uploaded files.

In one of the messages above, it was stated that it would be better to store the images in a filesystem and then have the DB link to the file. 

 

I can understand that storing it in the DB would take up a lot of space, but what would be strong reasons to store it in the filesystem instead of the DB directly?  Is the assumption that the web sites that have a large subscriber base i.e. several hundred thousand subscribers would store the images in their filesytem instead of in the DB as a blob?

 

 

Thank you,

Anita

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.