At what point does the upload occur in an html form? - html

Okay, so I've been handed this code (surrounding code is standard head/body framework and script defining "ConvertPPT2HTML()"):
<h1>Powerpoint Upload</h1>
<form id="form2" enctype="multipart/form-data" action="test_ppt_uploader.php" method="POST">
<table border="0" >
<tr>
<td ><b>Select File:</b> </td>
<td>
<input type=hidden name="pptfilename" id="pptfilename" value="">
<input type=hidden name="tempfilename" id="tempfilename" value="">
<input type="file" name="uploadedfile" id=upload size=25 >
</td>
<td>
<input type="submit" name=sub value="Upload File" onclick=" return ConvertPPT2HTML();"></td>
</tr>
</table>
</div>
</form>
The requirements are to:
Stop it from uploading any files from the client to the server
Keep it doing the ConvertPPT2HTML work (basically using AJAX to open the actual ppt file at the supplied path, saving a temp copy and a copy as html and then zipping it up for later upload)
The actual file is available in the php script after submit is hit, so my initial take was to remove:
enctype="multipart/form-data" action="test_ppt_uploader.php" method="POST">
Which does the job. But I'm not sure if the file is still being uploaded and discarded, or if it's not being uploaded at all.
I do want to keep the file widget around for browsing the file system, I just want to ensure it merely gives you a path, not an uploaded file.
So the specific question is Does the code below still upload anything?
<h1>Powerpoint Converter</h1>
<form id="form2">
<table border="0" >
<tr>
<td ><b>Select File TWJC:</b> </td>
<td>
<input type="file" name="uploadedfile" id=upload size=25 >
</td>
<td>
<input type="submit" name=sub value="Upload File" onclick=" return ConvertPPT2HTML();">
</td>
</tr>
</table>
</div>
</form>

Yes, if ConvertPPT2HTML() returns true then your form will still upload the PPT to the server. The form's action attribute defaults to the current URL.
You can use the "Network" tab in Chrome or IE's developer tools to watch the form submission.

Related

How can I get browsers to prompt user to save submitted username/password?

I've reviewed this post and this post, but they work for me. Those posts are 4-5 years old, so perhaps the browser rules for this have changed or gotten more specific?
Here is the form for login. There is no ajax and no javascript of any kind. I've tried changing the the input name from usernameOrEmailAddress to username and that doesn't change anything.
<form method="post" name="loginForm" id="loginForm" action="login-check.php" autocomplete="on">
<table>
<tr>
<th>Username or Email Address</th>
<td><input autofocus type="text" name="usernameOrEmailAddress" value="" required></td>
</tr>
<tr>
<th>Password</th>
<td><input id="password" type="password" name="password" value="" required title="Password"></td>
</tr>
</table>
<div class='row'>
<input class="inputsubmit button" name="login" type="submit" value="Login" />
</div>
</form>
Neither Chrome nor Firefox prompt to save the password for next time. What am I doing wrong?
Most browsers will do this automatically as long it can detect a username and a password field. Here is a picture on my computer when I just copy and pasted your code.
If it doesn't work for you, clear your cache and cookies then attempt again. Also what browser(s) are you using?

Image upload in HTML not working

Here the code which i have used to upload the image to server.But it returns "The requested URL / was not found on this server." error.
<form name="uploadFile" action="http://http.brammies.com" method="post" enctype="multipart/form-data" onSubmit="return validate();">
<input type="hidden" name="choice" value="upload">
<table align="center">
<tr>
<td><span style="color:red;font-weight:bold">Upload files</span></td><td><input type="file" id="ufile" name="ufile" onKeyPress="return false;" style="BACKGROUND-color:Thistle">(* jpg,gif,png)</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Upload" style="BACKGROUND-color:Thistle"></td>
</tr>
</table>
</form>
Can any one tell me whats wrong with my code?
The URL http://http.brammies.com does not refer to a form handler. From the outside, it is impossible to tell what the action attribute value should be.
From the response given by the server when http://http.brammies.com is accessed directly, it seems that the attribute value should be http://http.brammies.com/cgi-bin/ followed by some filename of a CGI script.

is there a way to save html form data with out web server or use of php?

This is an example of the code i have. there are multiple data fields that need saved and n seperate lines so the data is legible.
enter code here
<html>
<body>
<center>
<font size="2" face="arial" color="#CF18DC">
* Required Field</font></center>
<center><form enctype="multipart/form-data" method="post" action="" accept- charset="UTF-8">
<tr>
<td valign="top">
<center><strong><font color="#CF18DC">* </font>/Member #: </strong>
</td>
<td valign="top">
<input type="text" name="field-885d025b2e34341" id="field-885d025b2e34341" size="40" value="" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value=" Submit Form " />
</td>
</table>
</form>
</body>
</html>
i need a submit function or something to save the form data to a txt file in a local directory. I just cant figure this out can anyone please help? The file name that saves has to be the answer received in one of the collected data fields or it will just over write the file each time. Is this possible?
Not really. You will need some sort of contraption on the server side in order to write data to a source.
it does not have to be PHP. It can be any number of things; PHP, Python, Node.js, Ruby, etc.
You should easily be able to do this with some Javascript/Jquery. I'm not 100% sure this is what you're looking for, but I'm going on a hunch.
See htmlNewbie's question.
Hope this helps.

What is <input type="hidden" > used for in HTML?

I want to know what <input type="hidden"> is doing in the following HTML.
<form method="post" enctype="multipart/form-data">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>
it is specifying a form value that will including with the post, but not shown on the screen to the user, hence the hidden. In this case it is specifying the max file size that the form should allow to upload. It isn't very secure, since you can craft your own post to send.
Because it's just a bunch of data that's sent to the script, you just can guess it :)
My guessing is, that this field limits the size of the file you can upload - most likely in bytes, so it's around 2MB you can upload.
Please keep in mind, that the script, using this output does not need to handle this data. If it isn't handled in the script, it's ignored.
The file-size is may not only controlled by this hidden field ...
In general hidden input is added to send some additional info along with non-hidden data. It could be a session ID, encoded metadata, or whatever. Actually I don't see the reasons for adding MAX_FILE_SIZE cause this value could be set in php.ini file (in case of using PHP as a server-side platform).

Why data not retrieved using request.getParameter() when using post method in html

In my jsp code I use the request.getParameter() to retrieve the data which is entered in html. The data was retrieved when using get method but it is not when im using post method
Why this happend
My html form is
<code>
<form name="inp" action="upload.jsp" method="post" onsubmit="return valid();" enctype="multipart/form-data">
<table align="center" cellspacing="2">
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td><font size="5" color="#E41B17">Select File</font> </td>
<td><input type="file" name="infile"></td>
</tr>
<tr><td><font size="5" color="#E41B17">Target File Name</font></td>
<td><input type="text" size="20" name="filename"></input></td>
</tr>
<tr></tr>
<tr><td colspan="2" align="center"><input type=submit value="Upload" ></td></tr>
</table>
<br></br>
<center>
<font color="#E41B17">HOME</font>
</center>
</form>
</code>
And my jsp scriptlet is
<% String f = request.getParameter("filename");
System.out.println(f); %>
Thanks in Advance
Now to the issues: you've set the form's content type to be multipart, which means that you have to explicitly parse the request body; the container will only parse if you leave the default form-encoded. This article seems to give an example of how to access multipart data on the server side.
Aside from that, you do realize that your form is commented-out, so should never be handled by your browser, right? If you're actually seeing something on the browser, it probably isn't coming from this location.