473,486 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

picture preview not working!

ok, am trying to do a picture preview before i upload a picture, but i have
a tiny problem , it used to work but, not anymore.
here is the partial code (u do not need more to find the problem):
<html>
<IMG name=myimg height="100">
<form action="uploadpic.php" method="post"
ENCTYPE="multipart/form-data">
File: <input type="file" name="file" onChange="myimg.src=file.value"
size="30"> <input type="submit" value="Upload!">
<input name="cid" type="hidden" id="cid" value="'.$clientid.'">

</form>
</html>
now here what i noticed, when i try to upload a pic from lets say:
c:\picfolder\picture.jpg the file.value should have all that , and it
should give it to myimg.src but instead the myimg.src is having
http:\\mysite\picture.jpg

so what is wrong?

thanks,
Jim
Jun 3 '06 #1
3 4184
Jim S. said the following on 6/3/2006 12:21 AM:
ok, am trying to do a picture preview before i upload a picture, but i have
a tiny problem , it used to work but, not anymore.
here is the partial code (u do not need more to find the problem):
Yes, there is more needed.
<html>
<IMG name=myimg height="100">
<form action="uploadpic.php" method="post"
ENCTYPE="multipart/form-data">
File: <input type="file" name="file" onChange="myimg.src=file.value"
That onchange is IE-only.

onchange="document.images['myimg'].src=this.value"

And with that one change (I didn't test your IE only code), it does
exactly what is expected.
now here what i noticed, when i try to upload a pic from lets say:
c:\picfolder\picture.jpg the file.value should have all that , and it
should give it to myimg.src but instead the myimg.src is having
http:\\mysite\picture.jpg


Post a URL to a page that displays that behavior.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 3 '06 #2

Jim S. wrote:
ok, am trying to do a picture preview before i upload a picture, but i have
a tiny problem , it used to work but, not anymore.
here is the partial code (u do not need more to find the problem):
<html>
<IMG name=myimg height="100">
<form action="uploadpic.php" method="post"
ENCTYPE="multipart/form-data">
File: <input type="file" name="file" onChange="myimg.src=file.value"
size="30"> <input type="submit" value="Upload!">
<input name="cid" type="hidden" id="cid" value="'.$clientid.'">

</form>
</html>
now here what i noticed, when i try to upload a pic from lets say:
c:\picfolder\picture.jpg the file.value should have all that , and it
should give it to myimg.src but instead the myimg.src is having
http:\\mysite\picture.jpg

so what is wrong?


This question arose on another forum recently, and stems apparently
from a security issue. Someone said that I.E. 7 makes only the bare
filename available in the .value property of file type elements, even
though the full drive and path may appear in the associated text field.
This is the case already with Opera, so effectively scripted preview
facilites appear no longer to be viable without prompting the user to
enter the full path into a separate field.

Jun 3 '06 #3
well that makes sense, since am using IE 7 , but what is the work around?
and what it seems also that the path also is changed for whatever reason to
reflect the "site" address instead the local hard drive (the purpose of the
whole thing is to preview from the hard drive before the actual apload).
so, anyone thinks or knows of a solution?

also i tried to look at some premaid scripts for preview and it seems that
code is kinda absolete now, so ... where is our super coder for the help??

SOS super coder, we need u :)
thanks
jim

"Stephen Chalmers" <ig******@lycos.co.uk> wrote in message
news:11**********************@c74g2000cwc.googlegr oups.com...

Jim S. wrote:
ok, am trying to do a picture preview before i upload a picture, but i
have
a tiny problem , it used to work but, not anymore.
here is the partial code (u do not need more to find the problem):
<html>
<IMG name=myimg height="100">
<form action="uploadpic.php" method="post"
ENCTYPE="multipart/form-data">
File: <input type="file" name="file" onChange="myimg.src=file.value"
size="30"> <input type="submit" value="Upload!">
<input name="cid" type="hidden" id="cid" value="'.$clientid.'">

</form>
</html>
now here what i noticed, when i try to upload a pic from lets say:
c:\picfolder\picture.jpg the file.value should have all that , and it
should give it to myimg.src but instead the myimg.src is having
http:\\mysite\picture.jpg

so what is wrong?


This question arose on another forum recently, and stems apparently
from a security issue. Someone said that I.E. 7 makes only the bare
filename available in the .value property of file type elements, even
though the full drive and path may appear in the associated text field.
This is the case already with Opera, so effectively scripted preview
facilites appear no longer to be viable without prompting the user to
enter the full path into a separate field.

Jun 3 '06 #4

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

Similar topics

13
3234
by: Jim Carlock | last post by:
I have over a hundred pictures I would like to present. Is it practical to create and parse an array of pictures, picture paths, et al using server-side scripting to accomplish this? I...
4
12811
by: NASAdude | last post by:
I'm working on distributing a database using VS Tools for Office, and am having trouble with linked images on forms/reports. The image objects have a default path\file set on the .Picture property,...
3
3977
by: Michael A. Covington | last post by:
How easy is it to extend OpenFileDialog so that when a file is selected (clicked), my code will be called to extract some information from the file and display a picture?
9
4051
by: igotyourdotnet | last post by:
I need to create a print preview page BUT my page I need to print has a grid and in the grid I have 2 or 3 columns that have links I want to hide the columns with the links on my print preview page...
1
2840
by: davidwelli | last post by:
Hello, I have a Access 200 format database that contains contact details and a picture for each record. The contact details are held in one table and the images are held in another as OLE...
4
4957
by: cleelakumar | last post by:
Hi, How To Open The File(.lwl Extended File) Preview In Picture Box. I Tried ,but Picture Box Supports Only .jpeg And Image Files. If U Don't Mind Please Send To Me Code Of This Section....
1
3537
by: orson4music | last post by:
I have two picture boxes on my form. One on top of the other. The top most picture box's movement is restricted within the picture box below making it look like the top most picture box is contained...
6
2126
by: Joaquim Amado Lopes | last post by:
Greetings. Is there any way, in Javascript, to put in 2 variables the width and height of a picture, given the filename and without the picture being displayed in the webpage? Thank you,...
5
2346
pradeepjain
by: pradeepjain | last post by:
Hii guys, I used http://javascript.internet.com/forms/image-upload-preview.html for picture preview .Its working in IE but not in firefox .and ya he has said directly that...
0
7094
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,...
0
6964
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...
0
7123
Oralloy
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,...
0
7173
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...
1
6839
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...
0
5427
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,...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
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...

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.