| |

VerySource

 Forgot password?
 Register
Search
View: 742|Reply: 5

How to save uploaded attachments to the database

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-27 13:40:01
| Show all posts |Read mode
Dear brothers, how can I save the uploaded attachments in the database, and the database can mainly store the attachments casually.
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-2-20 18:00:01
| Show all posts
Converted to a byte stream and saved to the database.
Reply

Use magic Report

0

Threads

29

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-2-20 20:45:01
| Show all posts
Convert to byte stream
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-21 04:15:02
| Show all posts
Use BinaryReader to read Byte [] and save it to the database.
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-21 15:30:01
| Show all posts
System.IO.BinaryReader br = new System.IO.BinaryReader (File1.PostedFile.InputStream);
byte [] bytes = br.ReadBytes (File1.PostedFile.ContentLength);
br.Close ();
Reply

Use magic Report

2

Threads

13

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-3-7 17:30:02
| Show all posts
Learned another trick!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list