I have a form that contains several browse fields for users to upload files.
There is also a hidden field that is populated using javascript.
This script reads the value of the browse field, splits the string and
returns the name of the file to the hidden field. This is done so the file
name can be re-used.
My problem is that the javascript appears to be unable to read the browse
field in order to send the file name to the hidden field. This works
perfectly in IE, but Mozilla, Netscape and Firebird is a different story.
Is there a problem with my code, or is this a browser problem? If it is a
code problem, do you have any suggestions?
Here is the code and how it works:
function get_image_name( browse_field, hidden_field) { //file_name
var local_image = document.getEle mentById(browse _field).value;
var file_path_array = local_image.spl it("\\");
document.getEle mentById(hidden _field).value =
file_path_array[file_path_array .length-1];
}
Each browser and hidden form field have the same name, except for a number.
The values passed tot he function could be read as ('image_2',
'image_name_2')
1) browse_field - An onChange event triggers this function and the value of
the browse_field is stored in the variable local image.
2) The value of local_image is then split to create an array of the
directories and file name. I only need the file name.
3) The value of the last element in the array (the file name) is then passed
to the hidden field
Thanks for any and all help I can get.
Cy 1 1931
> This script reads the value of the browse field, splits the string and returns the name of the file to the hidden field. This is done so the file name can be re-used.
My problem is that the javascript appears to be unable to read the browse field in order to send the file name to the hidden field. This works perfectly in IE, but Mozilla, Netscape and Firebird is a different story.
Is there a problem with my code, or is this a browser problem? If it is a code problem, do you have any suggestions?
Here is the code and how it works:
function get_image_name( browse_field, hidden_field) { file://file_name
What's with the file:???
var local_image = document.getEle mentById(browse _field).value; var file_path_array = local_image.spl it("\\");
I would be very suspicious of the above line as you don't know how the
browser is reading the file path.
Why don't you put in some alerts so you can trace the variables?
alert(local_ima ge);
alert(file_path _array[file_path_array .length-1);
Jeff.
document.getEle mentById(hidden _field).value = file_path_array[file_path_array .length-1]; }
Each browser and hidden form field have the same name, except for a
number. The values passed tot he function could be read as ('image_2', 'image_name_2') 1) browse_field - An onChange event triggers this function and the value
of the browse_field is stored in the variable local image.
2) The value of local_image is then split to create an array of the directories and file name. I only need the file name.
3) The value of the last element in the array (the file name) is then
passed to the hidden field
Thanks for any and all help I can get. Cy
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to
able to load all 5000 pictures and view 50 per page using
mysql_data_seek(). I would like to know what are the advantages and
disadvantages of using a MySQL blob field rather than reading the
images directly from the file? How does one insert an image into a
blob field?...
|
by: Boris Wilhelms |
last post by:
Hello all,
at first, sorry for my bad English, I’ll give my best
We have a strange problem reading Text- and VarChar-Fields.
Our configuration:
-Windows 2003 Server
-MySQL Server 3.23.36
-MyODBC 3.51
|
by: Randell D. |
last post by:
HELP!
I am determined to stick with this... I'm getting there... for those who
haven't read my earlier posts, I'm createing what should be a simple
function that I can call to check that required fields in a form have
values. I'm writing the values to the client using document.write only so
that I can confirm that the values are there to...
|
by: Abyss |
last post by:
My view. anyone that doesn't like it tough, click off and stop reading it.
I have spent the last 45 minutes reading through all the posts, and I
believe that you have all missed the mark of that post.
The post was not about strict or transitional pages, it wasn't even about
|
by: jamait |
last post by:
Hi all,
I m trying to read in a text file into a datatable...
Not sure on how to split up the information though, regex or substrings...?
sample:
Col1 Col2 Col3
Col4
A0012430 REKAL TVÄTTMEDEL EKOMAX 0,5L ST 75.9000
| |
by: Sandi |
last post by:
I have a simple problem:
I have an Access database (images.mdb) that has 2 columns: one is the id of
the picture (an integer) and one (column named picture) is a field of type
OLE Object which contains an image (it can store jpg, bmp, gif, but I don't
know what image is stored inside).
I want to retrieve the picture stored in the database and...
|
by: Jerim79 |
last post by:
I did try to find the answer to this before posting, so this isn't a
knee jerk reaction.
What I am trying to accomplish is to have a script that opens a
cookie, reads a value, and then use a switch/case to take action based
on that value in the cookie. I want to set the cookie manually, so I
don't need setcookie(). I see that in PHP it...
|
by: Anish G |
last post by:
Hi,
I have an issue with reading CSV files.
I am to reading CSV file and putting it in a Datatable in C#. I am using a regular expression to read the values. Below is the code. Now, it reads CSV file without any issues only if all the fields are not null. If any field is blank, it moves the values to the left and displays the value under...
|
by: Stephen.Schoenberger |
last post by:
Hello,
My C is a bit rusty (.NET programmer normally but need to do this in
C) and I need to read in a text file that is setup as a table. The
general form of the file is
00000000 USNIST00Z 00000000_00 0 000 000 000 0000 000
I need to read the file line by line and eventually parse out each
piece of the file and store in arrays that...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |