473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Image upload problem across browsers

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("security.checkloaduri", 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\calc.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(document.all.item('userfile').value); returns 'calc.jpg' and not 'c:\misc\calc.jpg'. 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\calc.jpg' height='$userHeight' width='$userWidth'>
(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 2049
acoder
16,027 Expert Mod 8TB
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("security.checkloaduri", 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\calc.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(document.all.item('userfile').value); returns 'calc.jpg' and not 'c:\misc\calc.jpg'. How do i get the path?
Give the input file element an id and access it using document.getElementById("userfile").

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\calc.jpg' height='$userHeight' width='$userWidth'>
(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
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...
0
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,...
2
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...
0
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...
3
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...
1
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...
7
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 =...
7
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...
1
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...
26
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.