Page 1 of 1

file upload help

Posted: Tue May 01, 2007 11:33 pm
by barnes529
while registering new user.he is uploading his photo.how to store these files in database.if we running script on server.the path of the uploaded file(server) is stored in databse.but now i am running on localhost.how to store uploaded in database.
i need clear explanation about file uploading on server and localhost..thanks in advance for any help..

Posted: Tue May 01, 2007 11:43 pm
by feyd
There's rarely much of a difference between localhost and server unless you are using completely different server software.

The recommendation is to never store files in the database unless you absolutely, at a last resort, have to.

Posted: Tue May 01, 2007 11:59 pm
by neel_basu
Storing the file in database is a bad Idea.Just store teh file location in the database.
If you are thinking about the security Just put this .htaccess file in that dir where your uploaded files stays.

Code: Select all

Deny from all
<FilesMatch "^.*\.php|.*\.html$">
  ForceType application/x-httpd-php-source
</FilesMatch>

Posted: Wed May 02, 2007 12:22 am
by barnes529
okay..how to store path uploaded file in the databse.i am working on localhost.

Posted: Wed May 02, 2007 12:24 am
by feyd
Look for previous threads on the subject.

Also, look at what is in $_FILES.

Posted: Wed May 02, 2007 12:25 am
by barnes529
i am working on localhost.after uploading a file the file is stored in temp folder (www folder).i can store it in sepearte folder also.but how to store uploaded file path in database.

Posted: Wed May 02, 2007 12:30 am
by feyd
Do you understand how to store a string in the database? Same concept.