A
aaapaul
Hello !
I have created a webform to upload a bitmap and save in a database.
There is a <input type=file run=server>-Field where the user can select the file.
I have to buttons
Button 1: Preview
Is loading the selected file and showing in an image-field.
Button 2:
should upload the picture an save it to the database.
My problem ist, that when the user is making the preview,
the selected file is lost.
If the user wants to see the preview and then save to the database, he has
to select the picture-file two times.
Is it possible, that the path to the picture is available at the postback ?
Thanks
aaapaul
P.S.: my code
Private Sub PreviewButton_Click(...)
Try
Dim pfile As HttpPostedFile
Dim strFile As String
pfile = objFile.PostedFile
strFile = Server.MapPath("~/temp/") & Path.GetFileName(pfile.FileName)
Dim b As Bitmap = GetThumbnail(New Bitmap(pfile.InputStream), 0, 120)
b.Save(strFile, ImageFormat.Jpeg)
Me.bild.Src = "../temp/" & Path.GetFileName(pfile.FileName)
End Sub
I have created a webform to upload a bitmap and save in a database.
There is a <input type=file run=server>-Field where the user can select the file.
I have to buttons
Button 1: Preview
Is loading the selected file and showing in an image-field.
Button 2:
should upload the picture an save it to the database.
My problem ist, that when the user is making the preview,
the selected file is lost.
If the user wants to see the preview and then save to the database, he has
to select the picture-file two times.
Is it possible, that the path to the picture is available at the postback ?
Thanks
aaapaul
P.S.: my code
Private Sub PreviewButton_Click(...)
Try
Dim pfile As HttpPostedFile
Dim strFile As String
pfile = objFile.PostedFile
strFile = Server.MapPath("~/temp/") & Path.GetFileName(pfile.FileName)
Dim b As Bitmap = GetThumbnail(New Bitmap(pfile.InputStream), 0, 120)
b.Save(strFile, ImageFormat.Jpeg)
Me.bild.Src = "../temp/" & Path.GetFileName(pfile.FileName)
End Sub