Hi All,
Can anyone help me out with this one. I have a basic aspx page with an image placeholder on it. I want to be able to click a button on the page and have a dialog window appear where I can navigate the Client's PC and select a file (a JPG of GIF). I then want to change the image placeholder to display the selected image.
The problem I have is that I just can't work out how to browse the clients hard-disk. I have tried "
commonDialog1 = CreateObject("UserAccounts.CommonDialog")" and
"MyFolder = New System.Windows.Forms.FolderBrowserDialog"
but both give me a dialog window 'ghost' that is, the appear as a frame without any contents. The only way I know they are there is if I drag another application window over them. The screen tries to redraw them without any luck.
TIA,
Peter Wallington 2 1815
I would think you would have to use an html file upload input control. (You cannot create common dialog boxs on a web app). You should be able to grab the selected filename from it???
<INPUT id="File1" type="file" name="fileInput" runat="server">
pseduo code to upload a file, modify accordingly:
If Not File1.PostedFile Is Nothing AndAlso Not File1.PostedFile.FileName = String.Empty Then
Try
fileName = Server.MapPath("~\uploads\") & Path.GetFileName(File1.PostedFile.FileName.ToStrin g)
File1.PostedFile.SaveAs(fileName)
fileSize = CType(File1.PostedFile.InputStream.Length, Integer)
contentType = File1.PostedFile.ContentType()
Dim fs As FileStream = New FileStream(fileName, FileMode.Open, FileAccess.Read)
imagefile = New Byte(CType(fs.Length, Integer)) {}
fs.Read(imagefile, 0, CType(fs.Length, Integer))
fs.Close()
FileFound = True
Catch ex As System.IO.FileNotFoundException
Trace.Warn("file not found", ex.ToString)
Catch ex As Exception
Trace.Warn("upload", ex.ToString)
End Try
End If
HTH,
Greg
"Peter Wallington" <ne**@paradigm-it.com.au> wrote in message news:43***********************@per-qv1-newsreader-01.iinet.net.au...
Hi All,
Can anyone help me out with this one. I have a basic aspx page with an image placeholder on it. I want to be able to click a button on the page and have a dialog window appear where I can navigate the Client's PC and select a file (a JPG of GIF). I then want to change the image placeholder to display the selected image.
The problem I have is that I just can't work out how to browse the clients hard-disk. I have tried "
commonDialog1 = CreateObject("UserAccounts.CommonDialog")" and
"MyFolder = New System.Windows.Forms.FolderBrowserDialog"
but both give me a dialog window 'ghost' that is, the appear as a frame without any contents. The only way I know they are there is if I drag another application window over them. The screen tries to redraw them without any luck.
TIA,
Peter Wallington
You forgot one. <roll eyes>
microsoft.public.dotnet.framework.aspnet
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message news:u1****************@TK2MSFTNGP09.phx.gbl...
I would think you would have to use an html file upload input control. (You cannot create common dialog boxs on a web app). You should be able to grab the selected filename from it???
<INPUT id="File1" type="file" name="fileInput" runat="server">
pseduo code to upload a file, modify accordingly:
If Not File1.PostedFile Is Nothing AndAlso Not File1.PostedFile.FileName = String.Empty Then
Try
fileName = Server.MapPath("~\uploads\") & Path.GetFileName(File1.PostedFile.FileName.ToStrin g)
File1.PostedFile.SaveAs(fileName)
fileSize = CType(File1.PostedFile.InputStream.Length, Integer)
contentType = File1.PostedFile.ContentType()
Dim fs As FileStream = New FileStream(fileName, FileMode.Open, FileAccess.Read)
imagefile = New Byte(CType(fs.Length, Integer)) {}
fs.Read(imagefile, 0, CType(fs.Length, Integer))
fs.Close()
FileFound = True
Catch ex As System.IO.FileNotFoundException
Trace.Warn("file not found", ex.ToString)
Catch ex As Exception
Trace.Warn("upload", ex.ToString)
End Try
End If
HTH,
Greg
"Peter Wallington" <ne**@paradigm-it.com.au> wrote in message news:43***********************@per-qv1-newsreader-01.iinet.net.au...
Hi All,
Can anyone help me out with this one. I have a basic aspx page with an image placeholder on it. I want to be able to click a button on the page and have a dialog window appear where I can navigate the Client's PC and select a file (a JPG of GIF). I then want to change the image placeholder to display the selected image.
The problem I have is that I just can't work out how to browse the clients hard-disk. I have tried "
commonDialog1 = CreateObject("UserAccounts.CommonDialog")" and
"MyFolder = New System.Windows.Forms.FolderBrowserDialog"
but both give me a dialog window 'ghost' that is, the appear as a frame without any contents. The only way I know they are there is if I drag another application window over them. The screen tries to redraw them without any luck.
TIA,
Peter Wallington This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Popoxinhxan |
last post by:
HI guy
I am working on the web application that required to display
the chart image on the page. The process is clicking the button
and browser will popup another windows that displayed...
|
by: Satish Appasani |
last post by:
Hi:
I have a ASP.NET form with Web layout which I've achieved using panels. In
one of the tab I have a File control to upload Images. When I put a file in
the file control and move to another...
|
by: Stephen |
last post by:
Hi,
I am using an Access database (OLE Object) and storing Image as a bytes
after streaming. I am able to read it back as a stream and display it on the
browser using the following code:...
|
by: NH |
last post by:
Hi,
I'm struggling to display an image on asp.net webform (vb.net). The image is
stored in a image field in a sql server database.
I have read a good few solutions to it and still havnt got it...
|
by: Peter Wallington |
last post by:
Hi All,
Can anyone help me out with this one. I have a basic aspx page with an image placeholder on it. I want to be able to click a button on the page and have a dialog window appear where I can...
|
by: tshad |
last post by:
I am trying to set up an Image authorization where you type in the value
that is in a picture to log on to our site.
I found a program that is supposed to do it, but it doesn't seem to work.
...
|
by: computer_guy |
last post by:
Hi Everyone,
I run into a problem. I am trying to write an aspx that can
dynamically generate an image based on some input parameters.
Things are very simple if the size of the parameters is...
|
by: MikeB |
last post by:
Hello All, want to be able to pull images from the database and load them
into a bitmap through a stream which I have working. I then want to take
the bitmap and load it into a Image control...
|
by: manjitsarma |
last post by:
I need to display an image in 'Image Control' of aspx page.Now the image is displayed in the aspx page itself.But I need to display it in 'Image Control'.This is a map application and the image is...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
|
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...
| |