Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > storing images in filesystem

Reply
Thread Tools

storing images in filesystem

 
 
nbs6@yahoo.com
Guest
Posts: n/a
 
      02-16-2008
I am convinced that I want to store images in filesystem as to
database and store path into database Can someone point out an
article as to how to do it or help me I am using fileupload method but
I am getting nowhere
 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      02-17-2008
I'm not sure where the best article would be found, but I'm sure you could
find plenty with a search. But here is a basic example that should get you
started:

If fileupload1.HasFile AndAlso fileupload1.FileContent.Length > 0 Then
If Not System.IO.File.Exists(Server.MapPath(String.Concat ("/",
fileupload1.FileName))) Then
Me.fileupload1.PostedFile.SaveAs(Server.MapPath(St ring.Concat("/",
fileupload1.FileName)))
End If
End If

The first If statement checks to make sure a file has been selected and that
the file actually has content. The second If statement checks to make sure
that there is not already a file in the directory with that name. If both of
these If statements pass, then the SaveAs method of the PostedFile property
of the FileUpload control is called. Take note that you do not have to use
the filename of the original file, although whether or not you do depends on
the intended usage of you application. Also, take note of the Server.MapPath
function that I used. This is important, because you must specify the path
on the server. Hopefully this will get you started; if you have any
questions that you cannot find answers to, feel free to ask.
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am convinced that I want to store images in filesystem as to
> database and store path into database Can someone point out an
> article as to how to do it or help me I am using fileupload method but
> I am getting nowhere



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Images: Storing in Files VS Storing in Database Jonathan Wood ASP .Net 1 06-02-2008 05:56 PM
storing pointer vs storing object toton C++ 11 10-13-2006 11:08 AM
Storing Images? Adam J Knight ASP .Net 8 02-05-2006 01:41 AM
Help storing and Retrieving Images asp.net using vb.net blackg ASP .Net 2 03-09-2005 11:37 PM
Storing Images while Traveling fbj Digital Photography 10 10-29-2003 06:05 PM



Advertisments