473,659 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

get the full file path of file input field

Hello All,

I have a input box on the HTML page with the type set to file. What I
want is that when the value changes in the file textbox, it should give
me the full file path. I have even tried passing the value to a hidden
control but all it does is passes only the File Name and not the file
path.

How do I go about it. I tried checking GMAIL service (Compose Mail) but
all I could get is that they are passing the window and the file object
to a function, the code of which is not accessible.

Any help will be greatly valuable.

Regards,

Vibhu Bansal.

Jul 7 '06 #1
3 7163
Hi Vibhu

what you're trying to do probably not allowed because of security
restrictions of the browser sandbox. If the browser or web page were
given access to the contents or filepaths of the client machine it
could used maliciously. You don't need to know the filepath to send the
file to the server - the browser will attach and send the file to the
form data.

regards,
-ad
Vibhu wrote:
Hello All,

I have a input box on the HTML page with the type set to file. What I
want is that when the value changes in the file textbox, it should give
me the full file path. I have even tried passing the value to a hidden
control but all it does is passes only the File Name and not the file
path.

How do I go about it. I tried checking GMAIL service (Compose Mail) but
all I could get is that they are passing the window and the file object
to a function, the code of which is not accessible.

Any help will be greatly valuable.

Regards,

Vibhu Bansal.
Jul 7 '06 #2
Hi,

The reason why I want the full path of the file is that I want the file
to be uploaded in the background while the user is still on the
webpage; just the way GMAIL is attching files. I am sure using AJAX
this can be achieved.

So what I want is that the GET method of the .html page is invoked in
the background that will upload the file from the client to the server.

Hope this helps.

Regards,

Vibhu Bansal.
admataz wrote:
Hi Vibhu

what you're trying to do probably not allowed because of security
restrictions of the browser sandbox. If the browser or web page were
given access to the contents or filepaths of the client machine it
could used maliciously. You don't need to know the filepath to send the
file to the server - the browser will attach and send the file to the
form data.

regards,
-ad
Vibhu wrote:
Hello All,

I have a input box on the HTML page with the type set to file. What I
want is that when the value changes in the file textbox, it should give
me the full file path. I have even tried passing the value to a hidden
control but all it does is passes only the File Name and not the file
path.

How do I go about it. I tried checking GMAIL service (Compose Mail) but
all I could get is that they are passing the window and the file object
to a function, the code of which is not accessible.

Any help will be greatly valuable.

Regards,

Vibhu Bansal.
Jul 7 '06 #3
Hi Vibhu,

A submit action can have a target attribute. What you could do is create
a hidden IFRAME, make the FORM target the name of the IFRAME. When a
user clicks submit, the file will be uploaded outside the page the form
is on. Clear the form and the user can uload another one.

So:

<form id="uploadForm " ... other tags...>
<input type="file" name="upload">
<input type="button" value="Attach" onclick="upload ()">
</form>

... javascript:

var frameIndex = 0;

function upload() {
myFrame = document.create ElementId("IFRA ME");
myFrame.name = 'frame' + frameIndex;
// ... make IFRAME hidden
document.body.a ppendChild(myFr ame);
form = document.getEle mentById("uploa dForm");
form.target = 'frame' + frameIndex;
form.submit();
frameIndex++;
}

Something like that. I have never done it, but it should work in theory.
Also note that if you exit the window all uploads that are busy are
cancelled, so you should wait for the myFrame.content Window.onload to be
triggered before you can leave the page.
Good luck,
Vincent
Vibhu wrote:
Hi,

The reason why I want the full path of the file is that I want the file
to be uploaded in the background while the user is still on the
webpage; just the way GMAIL is attching files. I am sure using AJAX
this can be achieved.

So what I want is that the GET method of the .html page is invoked in
the background that will upload the file from the client to the server.

Hope this helps.

Regards,

Vibhu Bansal.
admataz wrote:
>Hi Vibhu

what you're trying to do probably not allowed because of security
restrictions of the browser sandbox. If the browser or web page were
given access to the contents or filepaths of the client machine it
could used maliciously. You don't need to know the filepath to send the
file to the server - the browser will attach and send the file to the
form data.

regards,
-ad
Vibhu wrote:
>>Hello All,

I have a input box on the HTML page with the type set to file. What I
want is that when the value changes in the file textbox, it should give
me the full file path. I have even tried passing the value to a hidden
control but all it does is passes only the File Name and not the file
path.

How do I go about it. I tried checking GMAIL service (Compose Mail) but
all I could get is that they are passing the window and the file object
to a function, the code of which is not accessible.

Any help will be greatly valuable.

Regards,

Vibhu Bansal.
Jul 7 '06 #4

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

Similar topics

9
5404
by: Don | last post by:
How do I retrieve the full path (C:\.....filename) of a file uploaded to a php script on the server. I think $_FILES will only provide 'name', which is only the filename itself. Thanks, Don ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =---
3
4842
by: Ben | last post by:
Hi all, i have file input field in a form like this: <input name="isbn" type="text" size="25" value="<?php echo $_POST ?>" /> <input name="image" type="file" size="25" value="<?php echo $_FILES ?>" /> when i press "submit" button, the same page gets loaded... if my $_POST is empty, i want to have the file path on "file input
1
5546
by: Monte Chan | last post by:
Hi all, I have the following codes, <script language="JavaScript"> function check_stuff(field) { alert("blank out the field now"); field.value = ""; } </script>
15
4752
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
2
5251
by: Sridhar | last post by:
Hi, I have a web form where it has a <input type=file id=file1> control. I have an Upload button to upload the file. WHen I click on browse and select one file, it is showing the full file path in the text box of File control. But in the code behind when I try to get the FullFile path using file1.PostedFile.FilePath it is not giving the full path (c:\test\test.pdf). Instead it is giving only file name (test.pdf). If i try to do this on...
3
23063
acoder
by: acoder | last post by:
How to Upload a File in Coldfusion Use the cffile tag for uploading files to the server. Note that allowing people to upload files is fraught with danger and only trusted users should be allowed to upload files. Checks should be made to make sure that only allowed file types are uploaded. The Client-Side First of all, let us deal with the client side. This assumes some knowledge of HTML.
4
2052
by: rn5a | last post by:
I am storing the physical path of images, along with 3 more columns, in a MS-Access DB table. I want to provide users the option to change this physical image path (as well as the records in the other columns) for which I am using the *File* Form element. The column under which the physical paths are stored is the 4th column in the DB table. Users first come to a page that displays the distinct records existing in column1 in the above...
2
7645
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but don't have any luck is to do a form validation. This script requires the files: db-file-to-disk.asp and _upload.asp. There is a DESCRIPTION field in the db-file-to-disk.asp file, what I want to do is the user has to field out this fied before...
2
3461
by: vol30w60 | last post by:
Is it possible to store the full path of a file upload, and return it in the value= attribute? Here is the scenario: A web form with some basic fields (name, address, etc.) plus a file upload field. If the user forgets to fill in a required field (eg, name), I show the form again, requesting them to fill in the required field. We don't want to force them to enter everything again, so the other fields have been pre-filled with their...
0
8339
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
8751
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
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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
5650
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
4176
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...
1
2757
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
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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 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...

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.