i am having imagefield in my page , i want to upload the image to database which is currently present in image field ,
1.i want to save the image to database in binary ...
Best way to do this is to have a seperate table in your database (I will assume you're using SQL Server for this example) with the following structure:
imgId (integer data type, primary key automatically incremented)
title (varchar data type)
type (varchar data type, the MIME type of the image ie 'image/jpeg' or 'image/gif')
data (image data type)
I'll use C# to show the rest, let me know if you can't switch it to VB. You'll need to be sure you have the following namespaces declared:
using System.IO; using System.Data; using System.Data.SqlClient;
And then the 'meat' of the code would be this:
// initial variables int imgSize; string imgType; Stream imgStream; // get image file size imgSize = imgUploadControl.PostedFile.ContentLength; // get image type imgType = imgUploadControl.PostedFile.ContentType; // get image stream imgStream = imgUploadControl.PostedFile.InputStream; // additional variables byte imgData = new byte[imgSize]; int readStatus; // read the data into a byte array (for SQL storage) readStatus = imgStream.Read(imgData, 0, imgSize);
Now you can store the imgData, imgType and a name for the image into your database. If you have any further questions, let me know.
Hope this helps.
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
I'm working in Excel to extract content of a table from a web page and populate Excel sheet cells with it. I'm trying to extract data from a table that gets loaded to a web page after show results method gets called. I have an error that says "Run-time error ...
When accessing from ######1.co.uk (which has an SSL) to document root ###/production everything works fine.
However when accessing ###/production from ######2.co.uk (which doesn't have an SSL - set up in the vhost file) the home page displays fine but the other pages are returning a 404.
Here's the entry in ...