Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2005

Tip: Looking for answers? Try searching our database.

Newbie: How to upload and save images using ASP.NET web forms (C#)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
charliewest - 16 Jul 2005 13:05 GMT
Hello -

I need to upload images in my web application using ASP.NET web forms
(written in C#). Since i have never done this before, i am unsure what is the
best method.

I assume there are two options:

1). Upload the images and save the files directory to the windows file
system. However, i assume this poses a security risk, as the file directory
will require write permissions.

2). Save the images (as objects?) in the SQL SERVER database.

Can anyone suggest the best way to do this? And, if possible, point me to
some sample code or artciles which explain how to do this.

Thanks!
Daniel Walzenbach - 16 Jul 2005 16:27 GMT
Charlie,

check out the following article:

http://www.codeproject.com/aspnet/fileupload.asp

I prefer to save files in the database but it depends on your needs.

If you need to save hundred thousands of files and decide that you want to
save them on your hard disk make sure to distribute them on different
directories. What you could do is that you assign a guid to each file and
create your directory structure accordingly.

Example:

You have five files with the following guids

0A59E8D6-0AE5-475B-8698-814C2C712029

F16CE1B1-56D0-42E6-9463-A58D553CC289

D90C27C7 -8BD9-4F47-8CFE-DE9D240AD136

370B6080-DF06-4DDE-BB5E-85264B8AE48B

861DC387-FDC7-4A4F-B0C3-9EA6734A562A

You could now create a directory like the following:

0A59E8D6\0AE5\475B\8698\814C2C712029

F16CE1B1\56D0\42E6\9463\A58D553CC289

D90C27C7 \8BD9\4F47\8CFE\DE9D240AD136

370B6080\DF06\4DDE\BB5E\85264B8AE48B

861DC387\FDC7\4A4F\B0C3\9EA6734A562A

HTHs

  Daniel

> Hello -
>
[quoted text clipped - 16 lines]
>
> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.