/    Sign up×
Community /Pin to ProfileBookmark

Image saved as blob in MySQL?

hey, i am having difficulty storing uploading my image into mysql.

the database has been set up to include a blob….

i have created a from:

[CODE]<form name=”vSignup” method=”post” enctype=”multipart/form-data” action=”processhotel.php”>

Photo:<input type=”file” name=”photo”>

<input type=”submit” name=”Submit” value=”Submit”>[/CODE]

this is sent to the page ‘processhotel.php’….

and this is the code i have on this page

[code=php]<?
$photo=$_POST[‘photo’];

$addmember = mysql_query(“INSERT INTO signuphotel VALUES (”,’$photo’)”);

?>[/code]

Essentially, i am attempting to keep the code as easy as possible. but at the moment, the database is storing it only as 0-kb, even though i did attempt to upload a photo.
the other details are being submitted fine into the database.

any help would be greatly appreciated.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@svidgenAug 25.2009 — The file gets dumped into a temporary file during the upload. You need to grab the data from there:

http://www.w3schools.com/PHP/php_file_upload.asp
×

Success!

Help @thegreatdanton spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...