PeopleSoft Community Network
Hi all,
My goal:
I want my users to be able to click the 'browse' button to select a file - and I want to programmatically retrieve the file path and file name. I don't need to upload the file anywhere. Just want the path and file name.
I've created an HTML Area that contains the javascript code below.
Is there a way for me to send the javascript filepath variable ( v_console) to a PeopleCode variable? Anyone?
Thanks in advance!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>input type=file & Firefox 3</title>
</head>
<body>
<h1>input type=file & Firefox 3</h1>
<script type="text/javascript">
// <![CDATA[
function inputFileOnChange() {
var v_console = '';
v_console += 'value: ' + document.getElementById('my-file').value;
v_console += '<br \/>';
if(document.getElementById('my-file').files) {
// Support: nsIDOMFile, nsIDOMFileList
v_console += 'files.length: ' + document.getElementById('my-file').files.length;
v_console += '<br \/>';
v_console += 'fileName: ' + document.getElementById('my-file').files.item(0).fileName;
v_console += '<br \/>';
v_console += 'fileSize: ' + document.getElementById('my-file').files.item(0).fileSize;
v_console += '<br \/>';
v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsDataURL();
// v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsBinary();
// v_console += 'data: ' + document.getElementById('my-file').files.item(0).getAsText();
v_console += '<br \/>';
};
document.getElementById('console').innerHTML = v_console;
};
// ]]>
</script>
<div>
<input type="file" name="my-file" id="my-file" onchange="inputFileOnChange();" />
<br /><br />
<code id="console">...console...< /code>
</div>
</body>
</html >
Tags:
© 2024 Created by Maisam Agha. Powered by