0

My DB developer made me a db with a field in the SQL table as image type. I am trying to take the image someone uploads and just insert it in.

$imagePath  = Input::file('image');
$image     =  $imagePath->getPathName();

$image returns the temp path name

$file = fopen($image, "rb");
$content = fread($file, filesize($image));
fclose($file);

$SqlConn =  "INSERT INTO [poll14] ([image]) VALUES ($content)";

But I get this error: An error occurred substituting the named parameters. How am I supposed to be inserting the data in?

user1899829
  • 397
  • 1
  • 3
  • 14

1 Answers1

0

Try this, which is similar to your requirement here

insert into poll14 (ImageColumn) 
SELECT BulkColumn 
FROM Openrowset( Bulk 'image..Path..here', Single_Blob) as img
Community
  • 1
  • 1
singhswat
  • 832
  • 7
  • 20