Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upload English and .gif together 1

Status
Not open for further replies.

jslmvl

Vendor
Joined
Jan 26, 2008
Messages
268
Location
GB
Hi,

This is quite difficult for me....

Sometimes, my users need to upload both English and .gif. I know I can do something like:

<form method="post" enctype="multipart/form-data" action="upload.asp">
text: <input type="text" name="text"><br>
file: <input type="file" name="file"><br>
<input type="submit">
</form>

and get the English and .gif, both in binary format, in page upload.asp. Then convert the binary string back to English.

Thinking the way, English - binary string - English, may waste time, I want I can submit English and .gif separately but by one button click.

Perhaps,
1. two forms + one button, or
2. dynamically change my form's tag:
if the user not upload a .gif, my form will use
<form method="post" action="upload.asp">
while when the user upload a .gif, my form will become
<form method="post" enctype="multipart/form-data" action="upload.asp">

Any idea?

Thank you in advance.
 
Hi

jslmvl said:
and get the English and .gif, both in binary format, in page upload.asp.
That is weird. Anyway :
Code:
<form method="post" enctype="multipart/form-data" action="upload.asp" [red]onsubmit="if(!this.file.value)this.enctype=''"[/red]>
text: <input type="text" name="text"><br>
file: <input type="file" name="file"><br>
<input type="submit">
</form>

Feherke.
 
Sorry, it not works....I cannot get anything from text input box....
 
Here is the page upload.html:

<form method="post" enctype="multipart/form-data" action="upload.asp" onsubmit="if(!this.file.value)this.enctype=''">
text: <input type="text" name="text"><br>
file: <input type="file" name="file"><br>
<input type="submit">
</form>

Here is the page upload.asp
<%
response.write request.form("text")
%>

I only typed string into type="text" box but got nothing in upload.asp. Anything wrong?
 
Hi

Code:
<form method="post" enctype="multipart/form-data" action="upload.php" onsubmit="if(!this.file.value)this.enctype=''">
text: <input type="text" name="text"><br>
file: <input type="file" name="file"><br>
<input type="submit">
</form>
Code:
<?php
echo $_POST['text'];
?>
Tested with FireFox, Opera and Konqueror. And works.

Maybe you should as in some kind of ASP forum...

Feherke.
 
I don't know php....
Did you check IE?
 
Perhaps the JavaScript this.enctype='' does not work in IE?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top