hi...
i got this filename test.txt with the location of c:\testfolder\t est.txt
i can get the full path name from the upload object. But i want to extract only the filename.(test. txt)
i tried using the split command but it gives me error when i run the javascript.
Error: object expected.
14 3024
look at this sample code ..... <input type = file id = test_file_uploa d>
now the js code ..............
document.getEle mentById('test_ file_upload').v alue.split('');
//try to use the split function like this what i suggested....
i hope it ll work.
kind regards.
dmjpro.
look at this sample code ..... <input type = file id = test_file_uploa d>
now the js code ..............
i hope it ll work.
kind regards.
dmjpro.
Hi thanks for the reply...
i already tried using the split command and it gives me error when i run the script. seems like splitting with '\' doesnt work. i tried '\', "\", '\\', "\\"
Hi thanks for the reply...
i already tried using the split command and it gives me error when i run the script. seems like splitting with '\' doesnt work. i tried '\', "\", '\\', "\\"
try using lastIndexOf(), and substring in combination.
fileName = filePath.substr ing(filePath.la stIndexOf("\\") );
try using lastIndexOf(), and substring in combination.
fileName = filePath.substr ing(filePath.la stIndexOf("\\") );
Hi.. this method doesnt work.
i tried the following script:
var path=document.f orm.file.value;
var fname=path.subs tring(path.last IndexOf("\\"));
alert(fname);
It gives me error:Object expected
Hi.. this method doesnt work.
i tried the following script:
var path=document.f orm.file.value;
var fname=path.subs tring(path.last IndexOf("\\"));
alert(fname);
It gives me error:Object expected
Your problem lies here:
document.form.f ile.value
you have named your form as form, but form is treated as keyword in javascript, so change name of your form to frm or abcForm or anything you like (which is not a keyword), then your code will run smoothly.
~~cheers~~
Your problem lies here:
document.form.f ile.value
you have named your form as form, but form is treated as keyword in javascript, so change name of your form to frm or abcForm or anything you like (which is not a keyword), then your code will run smoothly.
~~cheers~~
Hi thanks for the reply.
I changed the form name already but it still gives the same error.
document.upload _frm.file.value
Hi thanks for the reply.
I changed the form name already but it still gives the same error.
document.upload _frm.file.value
change the name of file element too.
see whatever you give type to input elements those all are treated specially. so you shouldn't use them as names. (for example, text, file, submit, button, radio, etc..)
change the name of file element too.
see whatever you give type to input elements those all are treated specially. so you shouldn't use them as names. (for example, text, file, submit, button, radio, etc..)
Hi sumittyagi.. its got nothing to do with the form or input names.. i changed it into different name and the same error happens.. thanks..
Hi sumittyagi.. its got nothing to do with the form or input names.. i changed it into different name and the same error happens.. thanks..
ok fine, paste you code whatever you are running here. I will see what's wrong with it.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul |
last post by:
Hi,
Using the code below I can extract the filename from a path but I would like
to know how to get just the path too.
So if the full path is "C:\A Long Time Ago\In A Galaxy\Far Far
Away\SomeFilename.txt"
The filename is: SomeFilename.txt
The path only is: C:\A Long Time Ago\In A Galaxy\Far Far Away\
I know there's other methods of getting the filename only, path only etc.
|
by: mickeydisn |
last post by:
Sub: C++ Word automation Extract text
hello.
I want extact text form a word document using a visual c++ programme.
I have see a lot of documentation. and my analysis is that I must use a
"word automation".
I have foud a lot of exemple to use it but I need your precious help to
|
by: Selen |
last post by:
I would like to be able to extract a BLOB from the database (SqlServer)
and pass it to a browser without writing it to a file. (The BLOB's
are word doc's, MS project doc's, and Excel spreadsheets.
How can I do this?
|
by: Joe |
last post by:
Hi,
I have a filename abcxyz.doc. Can someone tell me how do I extract the file
extension .doc from the filename in ASP.NET using VB.
For your reference a user is typing a filename in the textbox and I am
trying to parse this text. FileSystemObject is not useful here.
Thanks,
|
by: Scott Reynolds |
last post by:
Hello!
Could someone please provide me a sample, how to extract filename from url?
http://www.mydomain.com/eng/Default.aspx -> Default.aspx
Thanks
Scott
| |
by: Adam Faulkner via DotNetMonster.com |
last post by:
I want to create a method within a class that opens a Microsoft Word 2000
Document and has the facility to Create a new word document and then extract
a Page that exists within the original Word Document and save it to a new
Word Document.
I would need to generate a loop for each page found within a word document to
create a new word document and insert the existing page into the new word
document and then save as a new word document.
...
|
by: Fabian Braennstroem |
last post by:
Hi,
I would like to remove certain lines from a log files. I had
some sed/awk scripts for this, but now, I want to use python
with its re module for this task.
Actually, I have two different log files. The first file looks
like:
...
|
by: SteveB |
last post by:
I have posted this question in the Visual Basic 2005 and Visual
Basic .Net 2005 discussion groups, also.
Hi. I am developing an application/web page with VB.Net that will
populate a SQL database from text extracted from PDF documents.
However, I am having a difficult time finding or developing the
appropriate code to convert the PDF streams into text strings. Has
anyone developed code to convert PDF's to Text?
I was able write a...
|
by: Steve |
last post by:
Hi all
Does anybody please know a way to extract an Image from a pdf file and save
it as a TIFF?
I have used a scanner to scan documents which are then placed on a server,
but I need to extract the image of the document (just the first page if
there are multiple pages) and save it as a TIFF so I can then use the
Tesseract OCR to get the text in the image.
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |