UPDATE now getting no errors and 'success' but still no image in the data base. Updated code belowButton Element with Type Submit & PHP ChallengesPass two parameters in $.ajax success functionPHP throws an error when trying to insert image in MySql table?PHP uploading form problemsPHP - Import csv into database data too longCant upload and store the image to the database by using phpphp image update query, how to update the queryjquery ajax post doesn't workcreating php database and displaying its contents'move_uploaded_file(): Unable to move' Multiple Files XAMPP
Project Euler Problem 45
Phrase request for "work in" in the context of gyms
How to create large inductors (1H) for audio use?
How to measure the statistical "distance" between two frequency distributions?
What is the justification for Dirac's large numbers hypothesis?
French equivalent of "my cup of tea"
Looking for a big fantasy novel about scholarly monks that sort of worship math?
Types of tablet... a tablet secretion
Who's this voice acting performer?
Why are UK MPs allowed to not vote (but it counts as a no)?
Do I need to declare engagement ring bought in UK when flying on holiday to US?
Is Sanskrit really the mother of all languages?
What is the name for quantum gates that can be reversed?
What exactly is Apple Cider
Why does the seven segment display have decimal point at the right?
These roommates throw strange parties
What are the map units that WGS84 uses?
How do I make my fill-in-the-blank exercise more obvious?
Remaining in the US beyond VWP admission period
What do English-speaking kids call ice-cream on a stick?
Pronounceable encrypted text
If I sell my PS4 game disc and buy a digital version, can I still access my saved game?
Entering the US with dual citizenship but US passport is long expired?
Did the Byzantines ever attempt to move their capital to Rome?
UPDATE now getting no errors and 'success' but still no image in the data base. Updated code below
Button Element with Type Submit & PHP ChallengesPass two parameters in $.ajax success functionPHP throws an error when trying to insert image in MySql table?PHP uploading form problemsPHP - Import csv into database data too longCant upload and store the image to the database by using phpphp image update query, how to update the queryjquery ajax post doesn't workcreating php database and displaying its contents'move_uploaded_file(): Unable to move' Multiple Files XAMPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?
<?php
error_reporting( E_ALL );
?>
<?php
if (isset($_POST['submit']))
if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);
else
echo "error";
function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";
?>
php
add a comment |
updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?
<?php
error_reporting( E_ALL );
?>
<?php
if (isset($_POST['submit']))
if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);
else
echo "error";
function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";
?>
php
Can you please check if$_FILES['Image']['Description']
exist? Oh, and just to be sure, is theImage
in$_FILES['Image']
correct?
– Carl Binalla
Mar 28 at 5:18
add a comment |
updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?
<?php
error_reporting( E_ALL );
?>
<?php
if (isset($_POST['submit']))
if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);
else
echo "error";
function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";
?>
php
updated code and it's now displaying success but still no image in my database.
anyone have any idea why the image isnt being inserted?
<?php
error_reporting( E_ALL );
?>
<?php
if (isset($_POST['submit']))
if (getimagesize($_FILES['Image']['tmp_name'])==FALSE)
echo "failed";
else
$name=addslashes($_FILES['Image']['name']);
$image=base64_encode(file_get_contents(addslashes($_FILES['Image']['tmp_name'])));
saveimage($name,$image);
else
echo "error";
function saveimage($name,$image)
$con = mysqli_connect('', '','', '');
$sql = "INSERT INTO items ('image', 'Description') VALUES ($name, $image)";
$query=!mysqli_query($con,$sql);
if ($query)
echo "success";
else
echo "Not uploaded";
?>
php
php
edited Mar 28 at 5:30
s656
asked Mar 28 at 4:58
s656s656
11 bronze badge
11 bronze badge
Can you please check if$_FILES['Image']['Description']
exist? Oh, and just to be sure, is theImage
in$_FILES['Image']
correct?
– Carl Binalla
Mar 28 at 5:18
add a comment |
Can you please check if$_FILES['Image']['Description']
exist? Oh, and just to be sure, is theImage
in$_FILES['Image']
correct?
– Carl Binalla
Mar 28 at 5:18
Can you please check if
$_FILES['Image']['Description']
exist? Oh, and just to be sure, is the Image
in $_FILES['Image']
correct?– Carl Binalla
Mar 28 at 5:18
Can you please check if
$_FILES['Image']['Description']
exist? Oh, and just to be sure, is the Image
in $_FILES['Image']
correct?– Carl Binalla
Mar 28 at 5:18
add a comment |
3 Answers
3
active
oldest
votes
I have Found the issue
Please update your query using i have given
$sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";
add a comment |
Try adding an else to your outer if statement:
if (isset($_POST['upload']))
// code ...
else
// error code
That will at least tell you if the error lies with $_POST['upload']
.
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
add a comment |
You should check you image column datatype in database table this should be text or blob type.
yea its blob, thanks
– s656
Mar 28 at 5:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390453%2fupdate-now-getting-no-errors-and-success-but-still-no-image-in-the-data-base%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have Found the issue
Please update your query using i have given
$sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";
add a comment |
I have Found the issue
Please update your query using i have given
$sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";
add a comment |
I have Found the issue
Please update your query using i have given
$sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";
I have Found the issue
Please update your query using i have given
$sql = "INSERT INTO items (image, Description) VALUES ('".$name."', '".$image."')";
edited Mar 28 at 7:32
answered Mar 28 at 7:25
Jydipsinh ParmarJydipsinh Parmar
3262 silver badges11 bronze badges
3262 silver badges11 bronze badges
add a comment |
add a comment |
Try adding an else to your outer if statement:
if (isset($_POST['upload']))
// code ...
else
// error code
That will at least tell you if the error lies with $_POST['upload']
.
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
add a comment |
Try adding an else to your outer if statement:
if (isset($_POST['upload']))
// code ...
else
// error code
That will at least tell you if the error lies with $_POST['upload']
.
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
add a comment |
Try adding an else to your outer if statement:
if (isset($_POST['upload']))
// code ...
else
// error code
That will at least tell you if the error lies with $_POST['upload']
.
Try adding an else to your outer if statement:
if (isset($_POST['upload']))
// code ...
else
// error code
That will at least tell you if the error lies with $_POST['upload']
.
answered Mar 28 at 5:01
ChipsterChipster
2,2332 gold badges7 silver badges25 bronze badges
2,2332 gold badges7 silver badges25 bronze badges
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
add a comment |
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
yea that worked, thanks. turns out upload should have been submit. Now im getting Notice: Undefined index: image in /var/www/vhosts/imagetest.php on line 14 success (removed details from url)
– s656
Mar 28 at 5:07
add a comment |
You should check you image column datatype in database table this should be text or blob type.
yea its blob, thanks
– s656
Mar 28 at 5:14
add a comment |
You should check you image column datatype in database table this should be text or blob type.
yea its blob, thanks
– s656
Mar 28 at 5:14
add a comment |
You should check you image column datatype in database table this should be text or blob type.
You should check you image column datatype in database table this should be text or blob type.
answered Mar 28 at 5:07
gaurav krishnagaurav krishna
264 bronze badges
264 bronze badges
yea its blob, thanks
– s656
Mar 28 at 5:14
add a comment |
yea its blob, thanks
– s656
Mar 28 at 5:14
yea its blob, thanks
– s656
Mar 28 at 5:14
yea its blob, thanks
– s656
Mar 28 at 5:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55390453%2fupdate-now-getting-no-errors-and-success-but-still-no-image-in-the-data-base%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you please check if
$_FILES['Image']['Description']
exist? Oh, and just to be sure, is theImage
in$_FILES['Image']
correct?– Carl Binalla
Mar 28 at 5:18