Home > Software engineering >  How to get the image path to access the table
How to get the image path to access the table

Time:09-17

Small white has a problem: how to get the image path to access many thanks


Partial Class Default3
Inherits System. Web. UI. Page
Protected Sub Button1_Click (ByVal sender As Object, ByVal e the As System. EventArgs) Handles for. Click
If IsPostBack Then
Dim path As String=Server. MapPath (" ~/UploadedImages/")
Dim fileOK As Boolean=False
If FileUpload1. HasFile Then
Dim fileExtension As String
FileExtension=System. IO. Path. _
GetExtension (FileUpload1. The FileName). ToLower ()
Dim allowedExtensions As String ()=_
{" JPG ", "jpeg", "PNG", ". GIF "}
For I As Integer=0 To allowedExtensions. Length - 1
If fileExtension=allowedExtensions (I) Then
FileOK=True
End the If
Next
If fileOK Then
Try
FileUpload1. PostedFile. SaveAs (path & amp; _
FileUpload1. FileName)
Label1. Text="File uploaded!"

Catch the ex As Exception
Label1. Text="the File could not be uploaded."
End the Try
The Else
Label1. Text="always accept files of this type."
End the If
End the If
End the If


End Sub

CodePudding user response:

Baidu search relevant keywords,

CodePudding user response:

Search for files stored in the database

CodePudding user response:

Image path to access this path is actually very simple one thing is the character form, as long as you specify the field field length, enough to specify that a data after
Rs1. Fields (?)="image in the full path of the include file name and extension"
Rs1. Update

So you can, not sure if the field length error, remember that path if contains Chinese characters, a Chinese character of two characters in length,

To save space fixed folder path, database as long as the name with extensions can save the file,
  • Related