upload bitmap - problem with postback

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
 
G

Guest

if it is only the case of retrieving file path then you can save the path of
the file in btnpreview.commandargument /commandname.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top