You are here: Re: newbie: uploading image to MySql database « PHP Language « IT news, forums, messages
Re: newbie: uploading image to MySql database

Posted by Jeff on 01/18/07 17:18

See my post at the bottom of this message:

"Gene" <ox.gene@wp.pl> wrote in message
news:1169134046.203797.110340@38g2000cwa.googlegroups.com...
> good way to do this is not upload file to your database. I think you
> shold upload file to server file system, and only filename to your
> database. i've always do this thats way.
> Jeff napisal(a):
>> "Jeff" <it_consultant1@hotmail.com.NOSPAM> wrote in message
>> news:JMmdnRUP8rIZSDPYRVnzvQ@telenor.com...
>> > Hey
>> >
>> > I'm trying to develop a web portal using php 5.2.0. At this web portal
>> > I
>> > want to provide users with a picture upload functionality. They can
>> > upload
>> > pictures to their profiles etc. I want the pictures to be stored in the
>> > MySql database (storing images in db may not a good thing from a
>> > performance perspective). I'm not sure how to upload a picture file
>> > into a
>> > MySql database, so I've been googling for a while. I came accross this
>> > great example
>> > http://wellho.co.uk/solutions/php-example-php-form-image-upload-store-in-mysql-database-retreive.html
>> > I'm wondering if this code actually could work if many users are trying
>> > upload the files simultaneously. Is there a possibility when many uses
>> > are
>> > uploading images simultaneously that an image can be uploaded to the
>> > wrong
>> > profile?
>> >
>> > Jeff
>> >
>>
>> Okay. I haven't solved this issue, but I've read in the php
>> documentation.
>> So this post is considered solved. To make sure the file names are unique
>> it
>> could be a good idea to add a timestamp (using time() ) to the filename
>> of
>> the picture. And then use md5 on the filename...
>>
>> Jeff
>

Hey

Maybe I will do that instead of storing them in the database. But now I've
fixed this so the images are stored in the database. I've also made a .php
page displaying the pictures stored in the database. I made it this way
because I think it's cooler than storing the images in a directory (there
may be many images) ... Maybe there is a performance gain by having the
pictures stored on the filesystem?... But it's easier to administrate the
pictures of they are stored in the database (lets say i have to delete all
the pictures uploaded from a specific user, then I could do a simple "delete
from Picture where user = xx", instead of seaching through a folder on my
hard drive )... I start by having the pictures stored in the database, but
I'm open for suggestions (in fact I'm happy to hear your suggestion). Maybe
I should instead stored pictures in the filesystem... anyway, I can quikly
implement it that way if that is the best approach...

cheers

Jeff

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация