473,569 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

upload bitmap - problem with postback

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_C lick(...)
Try
Dim pfile As HttpPostedFile
Dim strFile As String
pfile = objFile.PostedF ile
strFile = Server.MapPath( "~/temp/") & Path.GetFileNam e(pfile.FileNam e)
Dim b As Bitmap = GetThumbnail(Ne w Bitmap(pfile.In putStream), 0, 120)
b.Save(strFile, ImageFormat.Jpe g)
Me.bild.Src = "../temp/" & Path.GetFileNam e(pfile.FileNam e)
End Sub
Nov 18 '05 #1
1 1263
if it is only the case of retrieving file path then you can save the path of
the file in btnpreview.comm andargument /commandname.

"aaapaul" wrote:
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_C lick(...)
Try
Dim pfile As HttpPostedFile
Dim strFile As String
pfile = objFile.PostedF ile
strFile = Server.MapPath( "~/temp/") & Path.GetFileNam e(pfile.FileNam e)
Dim b As Bitmap = GetThumbnail(Ne w Bitmap(pfile.In putStream), 0, 120)
b.Save(strFile, ImageFormat.Jpe g)
Me.bild.Src = "../temp/" & Path.GetFileNam e(pfile.FileNam e)
End Sub

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5395
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a web form to upload a TIFF image (scanned images) and convert it to a JPEG before I insert it into SQL Server. The file upload part works great, but...
0
5497
by: Benjamin Bittner | last post by:
Hallo NG, ive searched a lot in some google groups, and found many threads, but nothing that helped me. Here is the scenario: I have an aspx page which loads a user control in page.onInit like this Dim pdControl As bb.unit = CType(LoadControl("./content/unit.ascx"), bb.unit) phContent.Controls.Add(pdControl)
15
5312
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run...
0
2466
by: Raven Jones | last post by:
Heya all, I'm working on a web-based application (using ASP.NET and C# on .NET 1.1.4322, supporting only IE6 for Windows) that allows for file uploads. Screen real estate is at a premium, so I want to set its style to "display: none;" and interact only with the standard file upload dialog (which can be summoned by firing the click() method...
4
9676
by: Marko Vuksanovic | last post by:
I am trying to cause the uplaod button, id="Upload",when clicked, to exectue the onClick event for Button1, id="Button1". <asp:FileUpload id="FileUpload" runat="server"> </asp:FileUpload> <asp:Button id="Upload" Text="Upload file" runat="server"> </asp:Button> <asp:Button id="Button1" OnClick="UploadButton_Click" runat="server"...
4
2352
by: joe | last post by:
how to resize an upload image and then change to binary & insert to db
5
2244
by: bungle | last post by:
Hi Would anyone be able to offer advice on how they would upload images to SQL Server 2005 so that if they are too big the system will automatically resize them first? Obviously you need to get hold of the image first so do you store them to a temporary location first etc.??? This will be a web app. Any advice/discussion would be very...
5
1104
by: laziers | last post by:
Hi, I have 2 hostings one is in USA and the second is in the my country. So, is there any way to do uploading users pictures from the 1st server to secound without using FTP? Maybe upload control can do this? bye
3
4407
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine when iam using a normal web page... but can't in content page.... Code in Master Page <%@ Master Language="C#" AutoEventWireup="true"...
0
7698
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.