HTML - Form Problem - Input Type File.
Hi guys, I'm trying to create a form which uploads an image from the user and saves it in the database. However with the code I have so far it seems the input isn't working. Any help would be appreciated. This is what I have:
<html> <head><title>Store image into SQL Database</title></head> <body> PHP Code: <?php if ($_POST[submit]) { include("connect.php"); $data = addslashes(fread(fopen($_POST[form_data], "r"), filesize($_POST[form_data]))); $result=MYSQL_QUERY("INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) ". "VALUES ('$_POST[form_description]','$_POST[data]','$_POST[form_data_name]','$_POST[form_data_size]','$_POST[form_data_type]')"); $id= mysql_insert_id(); MYSQL_CLOSE(); } else { ?> HTML Code: <form method="post" action="imageupload.php" enctype="multipart/form-data"> File Description:<br> <input type="text" name="form_description" size="40"> <input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <br>File to upload/store in database:<br> <input type="file" name="form_data" size="40"> <p><input type="submit" name="submit" value="submit"> </form> <?php } ?> </body> </html> Similar TutorialsAny idea why the "theuploadedfile" input is not displayed when the program comes in after the submit ? PHP Code: <?php print 'Post=<pre>'; print_r($_POST);print '</pre>'; // PROBLEM $_POST['theuploadedfile'] IS NOT DISPLAYED (the text one is) ?> <form enctype="multipart/form-data" action="<?php print $_SERVER['PHP_SELF']; ?>" method="post"> <br>File to upload <input name="status" type="hidden" value="submitted"> <br>A<input name="thetexttype" type="text" size="100"> <br>B<input name="theuploadedfile" type="file" size="100" > <br><input name="submit" type="submit"> </form> The following common code is not working in Firefox (3.0.11). It works in Safari (4.02) and IE7. When I say not working, I mean that when I click the submit button, the address does not change to the form processing url: Code: <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="uploader.php" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="mp3file" type="file" /> <input type="submit" name="submit" value="Send File" /> </form> The file uploader.php does nothing, it is blank, I'm merely trying to establish communication. Once again, the code functions in IE and Safari so I dont think this is PHP related. I have a project written in ASP.NET under Visual Studio 2005 with C#. I am also using Infragistics objects for .NET Advantage 2007. In my page to attach resources to a record I have written a browser and am displaying previously chosen resources here. But when I click the upload button the page opens a new window (which is not a dialog window, but a normal one) which is exactly the same as my dialog window. How can this possibly happen? Can anyone help me? Hi, Below is my line of input code where I pass a certain variable. What I want to know is - is it possible to leave that 'identifer' value out of the url string if a user does not enter anything in that field? It's for a hotel reservation system and if left blank, it causes an error. It works fine is a user enters a code though. Code: <input type="text" name="identifier" value="" style="width:70px; font-size:11px;" /> Any ideas? Thanks Hi, I'm novice in webpage creating, and i have this kind of problem : I'm creating a webpage, where users could post some kind of a comment... I don't know did i choose rigth, but i'm using "input type="text" ...> users write there a comment, and press submit button. This comment is sent to mysql database and saved there, after submiting it. Next step is placing it in a webpage. It works, but ot that way as i want. A problem is : I've added a code like <input type="text" style="650px; height:150px" name="msg"> Input area is about height of 7-8 rows. I want that it worked like this : user types a text, and when it reaches the end of a line, cursor jumpt to the beneath row. Now, user is writing everything in one row, and when it reaches the end - scrollbar apear on the bottom. I would like that scrollbar would apear then, when user reaches the bottom of the input area. Moreover - i would like that user could press the ENTER button, to jump to next row. Now, when he does this - submit button is activated, and a written text is sent to the database. Should i use CSS? or ... i'm really green here, and don't know what to do .. hope anypne will answer to my SOS call I have a HTML form that truncates the action parameter after the "?" mark - which is NOT the desired behavior I am looking for. I simply want to open the referenced URL within the same viewport. Here is a representative HTML snippet: HTML Code: <form action="http://www.spufalcons.com/index.aspx?tab=gymnastics&path=gym"> <input type="submit" value="Gymnastics"/> </form> In this case, the submit button takes you to the "http://www.spufalcons.com/index.aspx" page, effectively ignoring "?tab=gymnastics&path=gym" parameter. It appears that URL's using HTML and PHP pages referenced in the action=URL work as expected BUT (alas) this is not the case when the target page contains index.aspx. This behavior is consistent across all major browsers (IE, FF, Safari, Chrome, Opera). Has anyone seen this problem before? Or can suggest an alternative and/or workaround consistent with my "pure" CSS/HTML/PHP web development approach? I have tried replacing the special characters with HTML entity values with no impact. I REALLY don't want to use abandon my CSS-styled submit buttons by using Javascript or button PNG's or image maps. Environment: Web Server: Apache 2.2.14 PHP: 5.2.10 OS: Mac OS X 10.5.8 HTML document info: HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> Hi, I have got an input form to upload files; the form also accepts some other user input. The upload works fine, but I need to display some filenames by default, but this does not work. I tried using: <input type="file" name="images[]" value="<?php echo $default_filename; ?>"... This did not work, so I tried: <input type="file" name="images[]" value="Testfile.jpg"..., but this does not work too. All this is in a <form action="<?php echo $_PHP_SELF; ?>" method="post" enctype="multipart/form-data">. It seems to me that in an input field of type "file", default values are not accepted, though they should be according to the documentation. Any help will be greatly appreciated as I need this feature. Thanks On my page, I have a form: HTML Code: <div id="upfile"> <input type="file" name="uploadform" size="30" id="fileupload2"> </div> Now, I'm wondering, is there any way that I can set a default value for this? Ex "C:\My Documents\file.txt". I tried value=, but I guess it doesn't work for the "file" type. I'd change it, but I need it to be "file".. Any help? Edit: Just realized that spelling mistake in the title.. Hey i'm wrting a simple iphone app (http://geo877.wsnw.net it will kinda run on Firefox and safari. NOT IE) I have a page where the user inputs some data using a form. I was trying to write a script to do the whole flick through page thing (where a users just drags the screen to change page). Anyway, the point is when i put the form into a div tag with the properties of position:relative; you can't click on any of the dropdown boxes or text input, i've read other people have had this problem but it was a pay for answer forum...The same problem happens when i put it in a table edit: It also causes the div or table to be above everything Thanks! <style> .dragme{position:relative;} </style> <div class="dragme"> <table id='mpc' style='display:none;' ><tr><td> <form action="index.php" onsubmit="return validate_form(this);" method="post"> <table> <tr> <td>Amount</td> <td><input type="text" name="amo" size="9" ; /></td> </tr> <tr> <td>Unit</td> <td><select name="unit"> <option value="Oz">Oz</option> <option value="Gram(s)">Grams</option> </select></td> </tr> <tr> <td>Metal</td> <td><select name="metal"> <option value="goldS">Gold Spot Price</option> <option value="silverS">Silver Spot Price</option> <option value="platS">Platinum Spot Price</option> <option value="fineGold">Fine Gold Price</option> </select></td> </tr> </table><p> <center><input type="submit" value="Calculate"/></center> </form> </div> I have the following tables coded in an e-mail which I send to new contacts to invite them to subscribe to our information network - there is more to the message but the rest seems to be working fine. When a contact receives the message and is just reading it, she or he can check the selections or the button to select the information category or the method of communication, but when she or he replies to or forwards the e-mail the selections disappear. Is there a way to retain the selections on the reply or forward? I also need this functionality for other e-mail requests. Any suggestions would be gratefully received. Please note: I am very much a novice and have inherited a lot of documents etc from my predecessor, i.e. the original e-mail is not of my own creation but one that I am attempting to modify to do what I need it to do. <TABLE class=resultscolor1> <TBODY> <FORM> <TR> <TD colSpan=5><BR> <DIV class=inputlabel1><FONT style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'" color=#0000ff size=4><B>Which of the following notices would you like to receive from GFTC? (Click to check a category; please select all that apply.) <BR></DIV></B></FONT> <TR> <TD vAlign=top><INPUT type=checkbox></TD> <TD><STRONG>Upcoming Courses & Events</STRONG></TD></TR> <TR> <TD vAlign=top><INPUT type=checkbox></TD> <TD><STRONG>GFTC Newsletter</STRONG> (Email editions in March & September. Print editions in June & December)</TD></TR> <TR> <TD vAlign=top><INPUT type=checkbox></TD> <TD><STRONG>Innovation Seminar Notices</STRONG> (events held for Members only; occasionally attendance is offered to Non-Members also; GFTC reserves the right to determine membership status)</TD></TR> <TR> <TD vAlign=top><INPUT type=checkbox></TD> <TD><STRONG>Industry Alerts</STRONG></TD></TR></FORM></TBODY></TABLE><TD colspan="5"><BR>How would you prefer to receive GFTC information updates? (Please select one.)<BR><BR> <DIV></DIV> <TABLE> <FORM> <TBODY> <TR> <TD><INPUT type=radio value="Email, Post" name=key4> </FONT>Email & Post<BR><INPUT type=radio value=Email name=key4> Email Only<BR><INPUT type=radio value="Fax, Post" name=key4> Fax & Post<BR><INPUT type=radio value=Fax name=key4> Fax Only<BR><INPUT type=radio value=Post name=key4> Post Only</TD></FORM></TR> </TBODY> </TABLE> Code: <form action="submitreg.php" method="post"> Desired Username: <input type="text"><br> Desired Password: <input type="text"> </form> This is just an ordinary unmodified form I have created. The problem is that the form positioning outputs like this: How do I make this look normal and aligned? Thank you Hi, I have got an anonymous emailer service but i want to change the input type into a drop down menu, How can I do this Here is my Code: Code: <!--Email Sender--> <h3>Your Email</h3> Select your email address from the list, Enter Subject, Then enter your text (use the additional header if you want). <div style="display: block; width: 1px; height: 10px;"><spacer type="block" width="1" height="10"></div> <form method=post action="https://riot.eu.org/cgi/remailer.cgi"> <label for="to" accesskey="r"></label> E-mail address:<br> <input TYPE="text" SIZE="20" NAME="to" id="to" MAXLENGTH="60"> <div style="display: block; width: 1px; height: 4px;"><spacer type="block" width="1" height="4"></div> Subject:<br> <input TYPE="text" SIZE="20" NAME="subject" MAXLENGTH="60"> <div style="display: block; width: 1px; height: 4px;"><spacer type="block" width="1" height="4"></div> Additional header (CC:,Bcc:,Newsgroup:..):<br> <textarea name="header" rows=3 cols=30></textarea> <div style="display: block; width: 1px; height: 4px;"><spacer type="block" width="1" height="4"></div> Message Text:<br> <textarea name="message" rows=10 cols=30 wrap=virtual></textarea> <div style="display: block; width: 1px; height: 6px;"><spacer type="block" width="1" height="6"></div> <div style="display: block; width: 1px; height: 8px;"><spacer type="block" width="1" height="8"></div> <input type="submit" value="Send" class="button"> </form> <div style="display: block; width: 1px; height: 20px;"><spacer type="block" width="1" height="20"></div> <table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td background="i/hr.gif"><div style="display: block; width: 1px; height: 1px;"><spacer type="block" width="1" height="1"></div></td></tr></table> <!--end Email Sender--> Thanks i have seen alot of place on web that sometimes programmers are using :- <input type="button" / > and sometimes <input type="button" > Is there any difference between the two? What is correct way of using <input> tag, is it with end slash '/' or not ? Hi all, I've created a simple login with some free code i found online. I wanted to change the login button to an image, just for aesthetics, but no matter what i try, it wouldnt work - the form does make sure i'm entering the right user & password, but once i do enter them, i get the same page with an empty form. (if i try the original type="button" code, it works just fine) I've been googling it for hours, with no results... i've tried anything and everything. ANY help would do :-) this is the code: <script language="javascript"> <!--// function pasuser(form) {if (form.id.value=="1") {if (form.pass.value=="1") {location="MainPage.htm"} else {alert("Invalid Password")}} else {alert("Invalid UserID")}} //--> </script> these are the buttons: WORKING BUTTON: <input type="button" value="Login" onClick="pasuser(this.form)"> NOT WORKING BUTTON: <input type="image" value="Login" onClick="pasuser(this.form)" src="Materials/Login.png" alt="Login" /> hi, i was wondering what is the best filetype to use for a video on the internet? i need to embed a video which can be viewed by as many people as possible so i was thinking maybe .wmv or something that can be played through windows media play and most other common video player I am generating a data file for Excel using XML structure. I have found 2 MIME types with partially expected functionality: application/xml: this works well assuming the user has a version of Excel that is associated with the headers in the file and/or the user doesn't have XML files associated with a separate application. application/vnd.ms-excel: this tends to append ".xls" to the end of the filename. When opening the file, Excel generates a warning that the data formats do not match because it is expect XLS format. If there is a 3rd MIME type, I'm not using a search engine that is aware of it. Can anyone suggest a MIME type that forces the application to open in Excel without presuming XLS format? How would I make a search-type form that would insert what the user typed in a text box into a web address and go to that address? (for example, if they type 'help' and click the submit button, it would go to the page "http://www.websitename.com/help.html") I know the general form code, but I can't figure out if I would use a tag in the 'onSubmit' portion, or use javascript, or something else altogether. I have a social network. I want my users to be able to pic colors for certain things... I'd really like to use the GUI that twitter has for this, but that could be expensive... So how do I do it? And how do i get smilies to input text into a text box like this one... Dynamic pages are going to be hard i think I didn't make this on frontpage. I made this through notepad. my teacher asked me to make a web page for an organization on our school's website. the whole thing is basically a form. so far i've just made the basic page without any designing yet. i'm sure i did everything correctly except for the submit button. what i want is when you click the submit button, for the browser to automatically send some sort of email to the provided address. instead, it opens up outlook. i don't want that to happen. what should i do to fix this? i will copy and paste my source code here but i will hide the email address with "*'s" just for privacy. Code: <html> <head> <title>Academy of Finance</title> </head> <body> <h1 align="center">Academy of Finance</h1> <h3 align="center">All Academy of Finance Alumni are invited to attend a reunion during the Thanksgiving weekend of 2009!</h3> <hr> <form action="mailto:********@gmail.com" method="post" enctype="text/plain"> <p> <b>Would you be interested in attending an Academy of Finance reunion Thanksgiving Weekend 2009?</b> <p> <input type="radio" name="yes" value="yes"> Yes <br> <input type="radio" name="no" value="no"> No <p> <b>Even if you answered no to this question, please fill out the following information so that we can verify that you will be unable to attend the reunion. Thank you!</b> <p> <fieldset> <legend> <b>Name:</b> </legend> <p> First Name: <input type="text" name="name" size="30"> <p> Last Name: <input type="text" name="name" size="30"> </fieldset> <p> <fieldset> <legend> <b>Address:</b> </legend> <p> City: <input type="text" name="city" size="30"> <p> State: <input type="text" name="state" size="30"> <p> Zip Code: <input type="text" name="zipcode" size="30"> </fieldset> <p> <fieldset> <legend> <b>Phone:</b> </legend> <p> Home Phone: <input type="text" name="state" size="30"> <p> Cell Phone: <input type="text" name="state" size="30"> </fieldset> <p> <fieldset> <legend> <b>Graduation Year</b> </legend> <p> Year of Graduation: <select name="year of graduation"> <option value="Select">Select</option> <option value="1990">1990</option> <option value="1991">1991</option> <option value="1992">1992</option> <option value="1993">1993</option> <option value="1994">1993</option> <option value="1995">1993</option> <option value="1996">1993</option> <option value="1997">1993</option> <option value="1998">1993</option> <option value="1999">1993</option> <option value="2000">2000</option> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> </select> </fieldset> <p> <fieldset> <legend> <b>Current Status</b> </legend> Current Organization: <input type="text" name="current organization" size="30"> <p> Current Occupation: <input type="text" name="current occupation" size="30"> </fieldset> <p> <fieldset> <legend> <b>College</b> </legend> College Attended: <input type="text" name="college attended" size="30"> <p> Degree Attained: <input type="text" name="degree attained" size="30"> </fieldset> <p> <fieldset> <legend> <b>Additional Comments</b> </legend> <blockquote> Additional Comments: <p> <textarea name="comments" id="comments"> </textarea> </blockquote> </fieldset> <p> <input type="submit" value="Submit"> <input type="reset" value="Clear All"> </body> </html> i really don't know what i did incorrectly. i'm not sure how i can get the submit button to send everything to my email directly without the use of any email manager. please help me out. thanks. Hello, I have a code ( see below) with a while loop that gives me a table that shows on the right side after every entry a link 'EDIT' that sends the variabe id to the script 'editjoke.php'. while ($joke = mysql_fetch_array($jokes)) { $id = $joke['id']; $joketext = htmlspecialchars($joke['joketext']); echo "<td>$joketext</td>\n"; echo "<td ><a href='editjoke.php?id=$id'>Edit</a></ td>\n"; echo "</tr>\n"; Now I created a new code with the same idea but it should have on the left side 'radio-buttons' and on the left side only one EDIT-button. Two days ago I thought it works but now it seems so that the variable is not send to editjoke.php. Here is the code: <form action="editjoke.php" method="post"> ... ... while ($num = mysql_fetch_array($number)) { //echo "<tr valign='top'>\n"; $id = $num['id']; $Auskunft = htmlspecialchars($num['Auskunft']); //echo "<td>$Auskunft</td>\n"; <input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="submit" value="SUBMIT" /> } </form> How do I have to change the code that the variable 'id' will be send to the script edithjoke.php? |