473,326 Members | 2,732 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,326 software developers and data experts.

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 7101
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.createElementId("IFRAME");
myFrame.name = 'frame' + frameIndex;
// ... make IFRAME hidden
document.body.appendChild(myFrame);
form = document.getElementById("uploadForm");
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.contentWindow.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
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 ...
3
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...
1
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
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...
2
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...
3
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...
4
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...
2
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...
2
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...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.