473,386 Members | 1,752 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,386 software developers and data experts.

Getting file from client w/o using a form post

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
10 2391
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: CHIN | last post by:
Hi all.. here s my problem ( maybe some of you saw me on other groups, but i cant find the solution !! ) I have to upload a file to an external site, so, i made a .vbs file , that logins to...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
5
by: Nathan Sokalski | last post by:
I have a user control that contains three variables which are accessed through public properties. They are declared immediately below the "Web Form Designer Generated Code" section. Every time an...
6
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= | last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an error: Could not find file 'C:\testfile.xls'. If I add the file (c:\testfile.xls) to the server I do not get the error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
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...

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.