473,772 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image upload problem across browsers

1 New Member
Hi,

I urgently need help. My code should let a user select an image file for upload, view the image on the browser to be able to set the image size then upload the image. It should also be compatible in IE, Opera and Firefox. Currently everything works well in IE only.

Problem:
1) I can't view an image from a local drive in Opera and Firefox. I am aware that Firefox doesn't link local files, so I set user_pref("secu rity.checkloadu ri", false); in user.js (Profiles folder), but it is still not working. i checked on about:config on the browser and the value is set as indicated. Why can't i view my images?
<img src='c:\misc\ca lc.jpg'>

2) When trying to access the file chosen by the user, i can only get the filename and not the whole path in Opera and Firefox.
eg. html code: <input name='userfile' type='file'>

window.alert(do cument.all.item ('userfile').va lue); returns 'calc.jpg' and not 'c:\misc\calc.j pg'. How do i get the path?

3) I read that the height and width attributes have been deprecated. how then can i allow my user to set up their sizes if i can only set image sizes in css and not in the html code itself:
<img src='c:\misc\ca lc.jpg' height='$userHe ight' width='$userWid th'>
(I'm also using php in mycode)

i'd really appreciate it if i can get a fast response. thanks.

Ntombi
Oct 19 '06 #1
1 2082
acoder
16,027 Recognized Expert Moderator MVP
1) I can't view an image from a local drive in Opera and Firefox. I am aware that Firefox doesn't link local files, so I set user_pref("secu rity.checkloadu ri", false); in user.js (Profiles folder), but it is still not working. i checked on about:config on the browser and the value is set as indicated. Why can't i view my images?
<img src='c:\misc\ca lc.jpg'>
This link should help.

2) When trying to access the file chosen by the user, i can only get the filename and not the whole path in Opera and Firefox.
eg. html code: <input name='userfile' type='file'>

window.alert(do cument.all.item ('userfile').va lue); returns 'calc.jpg' and not 'c:\misc\calc.j pg'. How do i get the path?
Give the input file element an id and access it using document.getEle mentById("userf ile").

3) I read that the height and width attributes have been deprecated. how then can i allow my user to set up their sizes if i can only set image sizes in css and not in the html code itself:
<img src='c:\misc\ca lc.jpg' height='$userHe ight' width='$userWid th'>
(I'm also using php in mycode)
AFAIK height and width are not deprecated. You can set them using JavaScript too, or use text boxes for input to set the image size on the server.
May 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2457
by: DH | last post by:
I have a "file upload form" that works OK, but I have been unsuccessful in my attempt to also resize the uploaded .JPG (if it is too wide), over-writing the original .JPG, and then create and save a thumbnail.jpg .... all at the same time. Links to a working example would be appreciated. Thanks.
0
2382
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload, I have two versions of the binary to string conversion one fast, one slow because some servers use chillisoft and therefore the append function in not accessible for a disconnected recordset.
2
4162
by: Faree | last post by:
Hi, I am a PHP Developer.can any one help me on image upload and display of that image.what i want is uploading an image to a directory ,displaying of that image as a thumbnail.when i click on that image the image should be diplayed in another page. I wrote code for image uploading and as well as display code.but i failed in image resizing when click on that :(
0
431
by: Daniel Kaplan | last post by:
Morning, I just added the CSS style below* to my CSS page and then used the class on type="submit" whereever I use a Submit button for a form. Just wanted to make the buttons stick out a little more is all. Well it turns out that when I do this, both FireFox and Netscape show the button as if it were an image file. In other words the "simulated push" don't work. Although everything works great in IE and Opera.
3
2049
by: Michael | last post by:
Hello, I want to write a componant that helps a user upload an image or file. I want something like you see on yahoo's image upload page. It has to work on mac and windows. Can anyone help me get started? Is there any sample code? Thanks, Michael
1
2278
pritipshah
by: pritipshah | last post by:
Hi All, I am using vtiger open source CRM and in that they are using FCKeditor for Image Upload (Resource browser window) but it is not upload or make new folder for image. Vtiger CRM fource to use IE for better performence so from the first day i was using IE7 for editing and testing. After some time today i tried it with Mozilla browser and Image upload works great in this browser, and sudanly i found that Image upload is not...
7
17058
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir = "photo/thumbs/"; // Path To Thumbnails Directory $twidth = "125"; // Maximum Width For Thumbnail Images
7
3733
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something. <form name="UpdatePropertyPicture" method="POST"...
1
4884
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop program,which can upload many file in folder.problem is,am unable to save my file name in to database.because i used same name for all input file type as file. i dont know get name of file.below i presented my coding for ur view.fed up with my coding..pls...
26
2402
matheussousuke
by: matheussousuke | last post by:
May someone help me correct this script? there a few ' and " and ; in the wrong places: <?php include "./comm.inc"; connectdb(); $sql = "SELECT imgid,imgtype FROM tblimage ORDER BY imgid"; $result = @mysql_query($sql) or die(mysql_error());
0
9454
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8934
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6713
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.