473,809 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fileupload in mysql mono

3 New Member
im trying to upload file in to mysql database using the following code.. but it shows jus the file name and not the entire file while i retrive. how to store the file and retrive it from mysql using mono c#. ?

Expand|Select|Wrap|Line Numbers
  1. cmd.CommandText="insert into fileup values('"+entry1.Text+"','"+filechooserbutton1.Filename+  "')";
  2.  
Feb 17 '12 #1
2 2165
PsychoCoder
465 Recognized Expert Moderator Contributor
It's really inefficient to store the actual file in your database, for something like this I would store just the file name and the path to the file.
Feb 17 '12 #2
nabdelmegeed
1 New Member
It is not advisable to load the whole image in the database. It's recommended to upload the file to the sever then save its path in the database. And in order to retrieve the image all you do is retrieve its path for the database.
Anyway, I know that mysql uses datatype BLOBs (Binary Large OBjects) to save large files. In C# we use an array of bytes. So, I guess you'll retrieve the image into an array of bytes then assign it to the image control.

There more explanation <Link Removed>. Good Luck
Feb 22 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11770
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
9
2171
by: John Bailo | last post by:
Retrieves a table from a mySql table into a Datagrid. Uses mono asp.net on a Suse Linux system: http://texeme.com/AspNetOnApache/Presidents1.aspx Shows aspx.net source code. -- Texeme Construct
4
7459
by: The Bear | last post by:
Has anyone successfully used MySQL with C#? I'm having problems using the Update command Here is the code snippet. I am able to connect to the database. However when I try to update the database with the changes in the dataset I get the following error: An unhandled exception of type 'System.InvalidOperationException' occurred
5
13567
by: Tim Bücker | last post by:
Hello. I am trying to get a connection to MySQL using OleDb but it seems that I am making something wrong. I´ve found this source in the net but it doesn´t work for me: System.Data.OleDb.OleDbConnection con; con=new System.Data.OleDb.OleDbConnection(""); con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test;"; con.Open();
2
269
by: ME | last post by:
I am getting: "ERROR SQLBindParameter not used for all parameters" when attempting to run the following code: Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.UpdateCommand
3
1099
by: Dave Smithz | last post by:
Hi there, A new potential client currently run there database on using MySQL and PHP, it has about 7000 records and runs rock solid over the web. However they need much more functionality and have approached me to build them a new database. However, they are used to rock solid reliability in their quite straight forward database (which is also cheap to run because it is opensource components), I have not yet implemented any largish...
13
1558
by: Jerome Tan | last post by:
hi there, how is vb.net database programming easier compare to php-mysql combination? i'm having trouble understanding how vb.net work compare to php-mysql database accessing. can anyone shed me light for easier understanding? thanks.
0
1495
by: narmathabala | last post by:
Hello, I need to insert BLOB into MySQL DB from a C#.NET 2.0 environment. The piece of code which I am using is listed below. Note: fileup is a FileUpload holder <code> Stream content = fileup.PostedFile.InputStream; byte bytedata = new byte; int n = content.Read(bytedata, 0, fileup.PostedFile.ContentLength);
0
1347
by: Christian Schlemmer | last post by:
If my code will run into the filesize-limit condition, the INSERT-statement will be executed. is there a way to avoid that? Protected Sub DetailsView1_RowInserting(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs) Dim FileUpload As FileUpload = DetailsView1.FindControl("Bild")
0
1724
by: Kim Charlene | last post by:
Hi, guys! I've created a java servlet where I can upload video with limited size. The video uploaded is being saved in the mySQL database as BLOB. How can I retrieve that BLOB and display it as the video in my webpage? I'm new to this so I'll need all the help and guidelines you guys can give me. Thank you very much in advance. Below is my servlet code: package Projects; import java.io.IOException; import java.io.PrintWriter; import...
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.