By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

Getting file from client w/o using a form post

P: n/a
Is it possible to get a file without using a form post?

I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a
file input element in it.

Ultimately what I want to do is get a file off client machine (that
they specify) and send it to the server using a standard post request.
This is exactly the same as a form post with an file input element,
but I don't want to use a form, I want to get the file data and
manipulate it first then post it back. So, the problem is, how can I
get the file from the client without using a form? Any pointers would
be appreciated.

Feb 25 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a
eg****@gmail.com scribed:
>Is it possible to get a file without using a form post?

I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a
file input element in it.
I create a string comprising the validated form input data separated with
some special character. Same as a cookie value is crafted. You can save it
as a log entry, a file, a long-term cookie, whatever your pleasure.
>
Ultimately what I want to do is get a file off client machine (that
they specify) and send it to the server using a standard post request.
This is exactly the same as a form post with an file input element,
but I don't want to use a form, I want to get the file data and
manipulate it first then post it back. So, the problem is, how can I
get the file from the client without using a form? Any pointers would
be appreciated.
On loading the form, fetch the 'encoded' value, split it at the special
character to form an array comprising the original form data, and use the
array data to fill in the form.
--
Ed Jay (remove 'M' to respond by email)
Feb 25 '07 #2

P: n/a
On Feb 24, 7:37 pm, Ed Jay <e...@aes-intl.comwrote:
egg...@gmail.com scribed:
Is it possible to get a file without using a form post?
I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a
file input element in it.

I create a string comprising the validated form input data separated with
some special character. Same as a cookie value is crafted. You can save it
as a log entry, a file, a long-term cookie, whatever your pleasure.
Ultimately what I want to do is get a file off client machine (that
they specify) and send it to the server using a standard post request.
This is exactly the same as a form post with an file input element,
but I don't want to use a form, I want to get the file data and
manipulate it first then post it back. So, the problem is, how can I
get the file from the client without using a form? Any pointers would
be appreciated.

On loading the form, fetch the 'encoded' value, split it at the special
character to form an array comprising the original form data, and use the
array data to fill in the form.
--
Ed Jay (remove 'M' to respond by email)
I'm still confused. Can you be move specific on how I can get the File
input data with javascript?

Feb 25 '07 #3

P: n/a
eg****@gmail.com scribed:
>On Feb 24, 7:37 pm, Ed Jay <e...@aes-intl.comwrote:
>egg...@gmail.com scribed:
>Is it possible to get a file without using a form post?
>I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a
file input element in it.

I create a string comprising the validated form input data separated with
some special character. Same as a cookie value is crafted. You can save it
as a log entry, a file, a long-term cookie, whatever your pleasure.
>Ultimately what I want to do is get a file off client machine (that
they specify) and send it to the server using a standard post request.
This is exactly the same as a form post with an file input element,
but I don't want to use a form, I want to get the file data and
manipulate it first then post it back. So, the problem is, how can I
get the file from the client without using a form? Any pointers would
be appreciated.

On loading the form, fetch the 'encoded' value, split it at the special
character to form an array comprising the original form data, and use the
array data to fill in the form.
--
Ed Jay (remove 'M' to respond by email)

I'm still confused. Can you be move specific on how I can get the File
input data with javascript?
One way:

<form...yadayada>
<input type = "text" id = "firstX" value = "X1">
<input type = "text" id = "secondX" value = "X2">
<input type = "checkbox" id = "thirdX" value = "X3">
</form>;

<script type="text/javascript>

x1 = document.forms["formname"].elements["firstX"].value;
x2 = document.forms["formname"].elements["secondX"].value;
x3 = document.forms["formname"].elements["thirdX"].checked;
myString = x1 + ","+ x2 + "," + x3;

</script>
--
Ed Jay (remove 'M' to respond by email)
Feb 25 '07 #4

P: n/a
Ed Jay said the following on 2/25/2007 10:55 AM:
eg****@gmail.com scribed:
>On Feb 24, 7:37 pm, Ed Jay <e...@aes-intl.comwrote:
>>egg...@gmail.com scribed:

Is it possible to get a file without using a form post?
I want to get the data (bytes) of a file, text or binary, and just
save it to a variable. Similar to the post body of a form that has a
file input element in it.
I create a string comprising the validated form input data separated with
some special character. Same as a cookie value is crafted. You can save it
as a log entry, a file, a long-term cookie, whatever your pleasure.

Ultimately what I want to do is get a file off client machine (that
they specify) and send it to the server using a standard post request.
This is exactly the same as a form post with an file input element,
but I don't want to use a form, I want to get the file data and
manipulate it first then post it back. So, the problem is, how can I
get the file from the client without using a form? Any pointers would
be appreciated.
On loading the form, fetch the 'encoded' value, split it at the special
character to form an array comprising the original form data, and use the
array data to fill in the form.
--
Ed Jay (remove 'M' to respond by email)
I'm still confused. Can you be move specific on how I can get the File
input data with javascript?

One way:

<form...yadayada>
<input type = "text" id = "firstX" value = "X1">
<input type = "text" id = "secondX" value = "X2">
<input type = "checkbox" id = "thirdX" value = "X3">
</form>;

<script type="text/javascript>

x1 = document.forms["formname"].elements["firstX"].value;
x2 = document.forms["formname"].elements["secondX"].value;
x3 = document.forms["formname"].elements["thirdX"].checked;
myString = x1 + ","+ x2 + "," + x3;

</script>
Re-read the original post. What is wanted is the file data from a file
on the client without using a file input. You can't do what is wanted.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 25 '07 #5

P: n/a
VK
On Feb 25, 7:06 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
What is wanted is the file data from a file
on the client without using a file input. You can't do what is wanted.
Noop... With XPCOM interfaces - and in a relaxed security environment
of course - one could make it for Gecko-based browsers. With IE even
security level drop doesn't help because FileSystemObject doesn't let
you to read binary files, only textual ones.

So either write a full-standing plugin / ActiveX to install for each
user or no way.
Feb 25 '07 #6

P: n/a
On Feb 25, 11:21 am, "VK" <schools_r...@yahoo.comwrote:
On Feb 25, 7:06 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
What is wanted is the file data from a file
on the client without using a file input. You can't do what is wanted.

Noop... With XPCOM interfaces - and in a relaxed security environment
of course - one could make it for Gecko-based browsers. With IE even
security level drop doesn't help because FileSystemObject doesn't let
you to read binary files, only textual ones.

So either write a full-standing plugin / ActiveX to install for each
user or no way.
Well, if I have to make the user install an activex component, I think
I'll just use a flash based upload solution.

Thanks.

Feb 25 '07 #7

P: n/a
VK
On Feb 25, 11:04 pm, "egg...@gmail.com" <egg...@gmail.comwrote:
Well, if I have to make the user install an activex component, I think
I'll just use a flash based upload solution.
Does ECMAScript part of ActionScript support local file access and
reading? I never heard about such methods - though I'm still using the
VB part of it so my knowledge is limited.
Feb 25 '07 #8

P: n/a
On Feb 25, 12:48 pm, "VK" <schools_r...@yahoo.comwrote:
On Feb 25, 11:04 pm, "egg...@gmail.com" <egg...@gmail.comwrote:
Well, if I have to make the user install an activex component, I think
I'll just use a flash based upload solution.

Does ECMAScript part of ActionScript support local file access and
reading? I never heard about such methods - though I'm still using the
VB part of it so my knowledge is limited.
Yeah, file upload solutions in flash are really common. Flash provides
the FileRefrence object which provides for local file system access.
Just do a google search, you'll find lots.

Feb 25 '07 #9

P: n/a
VK
On Feb 26, 12:19 am, "egg...@gmail.com" <egg...@gmail.comwrote:
Yeah, file upload solutions in flash are really common. Flash provides
the FileReference object which provides for local file system access.
Just do a google search, you'll find lots.
Cool, thanks for info. So one day it will be on Gecko browser too if
the deal doesn't break up and Mozilla takes over Tamarin - current
(ECMAScript)ActionScript engine - for the main Gecko engine.
That is not promised earlier than v.3/v.4 though.

Feb 25 '07 #10

P: n/a
On Feb 25, 1:34 pm, "VK" <schools_r...@yahoo.comwrote:
On Feb 26, 12:19 am, "egg...@gmail.com" <egg...@gmail.comwrote:
Yeah, file upload solutions in flash are really common. Flash provides
the FileReference object which provides for local file system access.
Just do a google search, you'll find lots.

Cool, thanks for info. So one day it will be on Gecko browser too if
the deal doesn't break up and Mozilla takes over Tamarin - current
(ECMAScript)ActionScript engine - for the main Gecko engine.
That is not promised earlier than v.3/v.4 though.
Oh, that's be interesting, I wasn't aware of this whole actionscript
mozilla thing.

Feb 26 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.