Search Results

Search found 208 results on 9 pages for 'enctype'.

Page 6/9 | < Previous Page | 2 3 4 5 6 7 8 9  | Next Page >

  • Can you target Google Chrome? (Yes, you can)

    - by Kyle Sevenoaks
    Hi, I need to position this update button on www.euroworker.no/order (you'll have to add an item to the cart, use the Kjøp button to add and Handlevogn to view the cart). Works in FF and IE. (Although there is another alignment problems with IE) but not in Chrome or Safari. I had it working before, but the only thing I can think of to do is target safari and Chrome. Is this possible? Here's the CSS and HTML(Smarty) for you. HTML(Smarty): {capture assign="cartUpdate"} <div id="cartUpdate"><!--<input type="submit" class="submit" value="{tn _update}" />--> <button type="submit" class="submit" id="oppdatersubmit" name="saveFields" title="Oppdater" value="">&nbsp;</button> </div> {/capture} {assign var="cartUpdate" value=$cartUpdate|@str_split:10000} {php}$GLOBALS['cartUpdate'] = $this->get_template_vars('cartUpdate'); $this->assign_by_ref('GLOBALS', $GLOBALS);{/php} {form action="controller=order action=update" method="POST" enctype="multipart/form-data" handle=$form id="cartItems"} CONTENT {/form} And the CSS: #oppdatersubmit { background-image:url(../../upload/oppdater.png); background-repeat:no-repeat; background-position:left; background-color:none; border:none; overflow:hidden; outline:none; white-space: nowrap; width:77px; height:25px; cursor:pointer; position:absolute; } #cartUpdate { position:absolute; width:160px; height:30px; left:580px; bottom:130px; } Need to change these for Chrome and Safari. Thanks.

    Read the article

  • problem when uploading file

    - by Syom
    i have the form, and i want to upload two files. here is the script <form action="form.php" method="post" enctype="multipart/form-data" /> <input type="file" name="video" /> <input type="file" name="picture" > <input type="submit" class="input" value="?????" /> <input type="hidden" name="MAX_FILE_SIZE" value="100000000" /> </form> form.php: <? print_r($_FILES); $video_name = $_FILES["video"]["name"]; $image_name = $_FILES["picture"]["name"]; echo "video",$video_name; echo "image",$image_name; //returns Array ( ) videoimage ?> when i try to upload the file greater than 10MB, it doesn't happen. i try in many browsers. maybe i must change some field in php.ini? but i haven't permission to change them on the server. so what can i do? thanks

    Read the article

  • Adding a Click event to a submit button and then submitting the form

    - by Abs
    Hello all, I have a form with a submit button. I have attached a click event to that submit button using JQuery. Once I did this my form wasn't submitting, I thought this was because of the event I added- if I remove that click event it submits the form successfully. I have tried giving my form an id and calling the submit function but this was not successful either. What can I do? $('#submit_gen').click(function() { $('#genbtn').html('<img src="images/ajax-loader.gif" alt="loading" />'); $('#action_form').submit(); }); The HTML: <form id="action_form" action="generate.php" method="post" enctype="multipart/form-data"> <input id="file_upload" type="file" name="upload" onchange="file_select();"/> <input type="text" id="overlay_input"> <div id="genbtn" class="genbtn"> <input id="submit_gen" type="submit" value="Upload"> </div> </form> Thanks all

    Read the article

  • how to arrange the checkboxes in 3/3 format on a layout of a form

    - by anwaar
    hi there can anyone plz tell me how to arrange the list of checkboxes of cuisines label which is retrived from the data base and when it is displaying it is not in the order coming side by side all together i want it to be displayed in a 3 by 3 format.here is the code for that: <div id="frmform"> <form name="frmrestaurant" id="frmrestaurant" method="post" onsubmit="" enctype="multipart/form-data"> <p class="msgsignup">Add Restaurant</p> <div id="iderror"></div> <div class="topinputs"> <div> <label for="restaurant_name" class="name">Restaurant Name :</label><input type="text" name="restaurant_name" size="32" id="restaurant_name" value="<?php echo $row->restaurant_name; ?>" class="validate[required,custom[onlyLetter],length[0,100]] text-input" /> </div> </div> <div> <label for="website" class="name">Website :</label><input size="32" type="text" name="website" id="website" value="<?php echo $row->website; ?>" class="validate[required,length[0,100]] text-input" /> </div> <div> <label for="budget" class="name">Budget :</label> <?php echo $this->lists['budget'];?> </div> <div> <label for="idcuisine" class="cuisine" >Cuisine:</label> <?php echo $this->lists['cuisine'] ;?> <div> <label for="idcategory" class="category">Category:</label> <?php echo $this->lists['category'];?> </div> the lists of cuisine and category is not displaying properly. thanks.

    Read the article

  • Image Upload with Mootools

    - by notme
    I am creating an ajax uploader with mootools. When I remove the ajax and simply upload the form I get $_FILES with the file data present. But when I use the ajax version, the $_FILES super global is empty. Every other part of the form is present. It acts as if it does not send the image at all but only in the ajax version. Any help is appreciated. Thanks! <form id="uploadphoto_pod" action="upload.php" enctype="multipart/form-data" method="post"> <input type='file' id='uploadphoto' name='uploadphoto'/> <input type="submit" class="submit" name="add_product" value="Upload" /> </form> <div id="response"><!-- Ajax Response --></div> <script type="text/javascript"> window.addEvent('domready', function(){ $('uploadphoto').addEvent('submit', function(e) { //Prevents the default submit event from loading a new page. e.stop(); //("this" refers to the $('uploadphoto') element). this.set('send', {onComplete: function(response) { $('response').set('html', response); }}); //Send the form. this.send(); }); }); </script>

    Read the article

  • PHP - Undefined index error

    - by user1815290
    This is my form with a file input field named "photo": <form action = "spremi-film.php" method = "POST" enctype = "multipart/form-data"> <div class="grid_2">Naslov:</div> <div class="grid_10"><input type="text" name="naslov" value="" /></div> <div class="grid_2">Žanr: </div> <div class="grid_10"><?php izborZanra(); ?></div> <div class="grid_2">Godina: </div> <div class="grid_10"><?php izborGodine(); ?></div> <div class="grid_2">Trajanje:</div> <div class="grid_10"><input type="text" name="trajanje" value="" /></div> <div class="grid_2">Izbor slike:</div> <!--<input type="hidden" name="MAX_FILE_SIZE" value="30000" />--> <div class="grid_10"><input type="file" name="photo" /></div> <div class="grid_12"><input type="submit" value="SPREMI" /></div> </form> After that i put this code: $uploaddir = '/slike'; $uploadfile = $uploaddir . basename($_FILES['photo']['name']); //echo '<pre>'; if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) { echo 'Slika je uspješno spremljena!'; } else { echo 'Slika nije spremljena!'; } //print_r($_FILES); //echo '</pre>'; When i run this i have an undefined index: photo notice in my browser. Help, please.

    Read the article

  • can't load big files to server with php [closed]

    - by yozhik
    Hi all! I can't load big files to server. The problem is in that file $_FILES["filename"]["tmp_name"] is empty if file a little more bigger then 2mb. I tried to change variables in php.ini upload_max_filesize = 700M post_max_size = 16M but not working to. Also tried to add this variables to my .httaccess file - but 500 error appears. Error code while uploading=1. UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini. Here is my uppload.php page, please anwer what I doing wrong? Thanx! <?php if(strlen($_FILES["filename"]["name"])) { $folder = "uploads/"; echo $folder; $error = ""; if($_FILES["filename"]["size"] > 1024*700*1024) { $error .= "<b><p class=ErrorMessage>?????? ????? ????????? 5Mb</p></b><br>"; header("Location: upload.php?error=".$error, true, 303 ); } if(!file_exists($folder.="hh/")) { if(!mkdir($folder, 0700)) $error .= "<b><p class=ErrorMessage>Folder not created</p></b><br>"; } //echo "<br>".$_FILES["filename"]["tmp_name"]."<br>"; echo $folder.$_FILES["filename"]["name"]."<br>"; echo $_FILES["filename"]["error"]."<br>"; if(move_uploaded_file($_FILES["filename"]["tmp_name"], $folder.$_FILES["filename"]["name"])) { echo("???? ??????? ???????? <br>"); echo("?????????????? ?????: <br>"); echo("??? ?????: "); echo($_FILES["filename"]["name"]); echo("<br>?????? ?????: "); echo($_FILES["filename"]["size"]); echo("<br>??????? ??? ????????: "); echo($folder.=$_FILES["filename"]["name"]); echo("<br>??? ?????: "); echo($_FILES["filename"]["type"]); } else { $error .= "<b><p class=ErrorMessage>?????? ???????? ?????</p></b><br>"; } } ?> <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>???????? ??? ????????</title> </head> <body> <?php if(isset($_REQUEST["error"])) { echo $_REQUEST["error"]; } ?> <h2><p><b> ????? ??? ???????? ?????? </b></p></h2> <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="filename" READONLY><br> <input name="Upload" type="submit" value="Upload"><br> </form> </body> </html>

    Read the article

  • Alternative way of developing for ASP.NET to WebForms - Any problems with this?

    - by John
    So I have been developing in ASP.NET WebForms for some time now but often get annoyed with all the overhead (like ViewState and all the JavaScript it generates), and the way WebForms takes over a lot of the HTML generation. Sometimes I just want full control over the markup and produce efficient HTML of my own so I have been experimenting with what I like to call HtmlForms. Essentially this is using ASP.NET WebForms but without the form runat="server" tag. Without this tag, ASP.NET does not seem to add anything to the page at all. From some basic tests it seems that it runs well and you still have the ability to use code-behind pages, and many ASP.NET controls such as repeaters. Of course without the form runat="server" many controls won't work. A post at Enterprise Software Development lists the controls that do require the tag. From that list you will see that all of the form elements like TextBoxes, DropDownLists, RadioButtons, etc cannot be used. Instead you use normal HTML form controls. But how do you access these HTML controls from the code behind? Retrieving values on post back is easy, you just use Request.QueryString or Request.Form. But passing data to the control could be a little messy. Do you use a ASP.NET Literal control in the value field or do you use <%= value % in the markup page? I found it best to add runat="server" to my HTML controls and then you can access the control in your code-behind like this: ((HtmlInputText)txtName).Value = "blah"; Here's a example that shows what you can do with a textbox and drop down list: Default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="NoForm.Default" %> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="NoForm.Default" %> <!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"> <head runat="server"> <title></title> </head> <body> <form action="" method="post"> <label for="txtName">Name:</label> <input id="txtName" name="txtName" runat="server" /><br /> <label for="ddlState">State:</label> <select id="ddlState" name="ddlState" runat="server"> <option value=""></option> </select><br /> <input type="submit" value="Submit" /> </form> </body> </html> Default.aspx.cs using System; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; namespace NoForm { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Default values string name = string.Empty; string state = string.Empty; if (Request.RequestType == "POST") { //If form submitted (post back) name = Request.Form["txtName"]; state = Request.Form["ddlState"]; //Server side form validation would go here //and actions to process form and redirect } ((HtmlInputText)txtName).Value = name; ((HtmlSelect)ddlState).Items.Add(new ListItem("ACT")); ((HtmlSelect)ddlState).Items.Add(new ListItem("NSW")); ((HtmlSelect)ddlState).Items.Add(new ListItem("NT")); ((HtmlSelect)ddlState).Items.Add(new ListItem("QLD")); ((HtmlSelect)ddlState).Items.Add(new ListItem("SA")); ((HtmlSelect)ddlState).Items.Add(new ListItem("TAS")); ((HtmlSelect)ddlState).Items.Add(new ListItem("VIC")); ((HtmlSelect)ddlState).Items.Add(new ListItem("WA")); if (((HtmlSelect)ddlState).Items.FindByValue(state) != null) ((HtmlSelect)ddlState).Value = state; } } } As you can see, you have similar functionality to ASP.NET server controls but more control over the final markup, and less overhead like ViewState and all the JavaScript ASP.NET adds. Interestingly you can also use HttpPostedFile to handle file uploads using your own input type="file" control (and necessary form enctype="multipart/form-data"). So my question is can you see any problems with this method, and any thoughts on it's usefulness? I have further details and tests on my blog.

    Read the article

  • ASP.NET MVC Html.ValidationSummary(true) does not display model errors

    - by msi
    I have some problem with Html.ValidationSummary. I don't want to display property errors in ValidationSummary. And when I set Html.ValidationSummary(true) it does not display error messages from ModelState. When there is some Exception in controller action on string MembersManager.RegisterMember(member); catch section adds an error to the ModelState: ModelState.AddModelError("error", ex.Message); But ValidationSummary does not display this error message. When I set Html.ValidationSummary(false) all messages are displaying, but I don't want to display property errors. How can I fix this problem? Here is the code I'm using: Model: public class Member { [Required(ErrorMessage = "*")] [DisplayName("Login:")] public string Login { get; set; } [Required(ErrorMessage = "*")] [DataType(DataType.Password)] [DisplayName("Password:")] public string Password { get; set; } [Required(ErrorMessage = "*")] [DataType(DataType.Password)] [DisplayName("Confirm Password:")] public string ConfirmPassword { get; set; } } Controller: [HttpPost] public ActionResult Register(Member member) { try { if (!ModelState.IsValid) return View(); MembersManager.RegisterMember(member); } catch (Exception ex) { ModelState.AddModelError("error", ex.Message); return View(member); } } View: <% using (Html.BeginForm("Register", "Members", FormMethod.Post, new { enctype = "multipart/form-data" })) {%> <p> <%= Html.LabelFor(model => model.Login)%> <%= Html.TextBoxFor(model => model.Login)%> <%= Html.ValidationMessageFor(model => model.Login)%> </p> <p> <%= Html.LabelFor(model => model.Password)%> <%= Html.PasswordFor(model => model.Password)%> <%= Html.ValidationMessageFor(model => model.Password)%> </p> <p> <%= Html.LabelFor(model => model.ConfirmPassword)%> <%= Html.PasswordFor(model => model.ConfirmPassword)%> <%= Html.ValidationMessageFor(model => model.ConfirmPassword)%> </p> <div> <input type="submit" value="Create" /> </div> <%= Html.ValidationSummary(true)%> <% } %>

    Read the article

  • Asp.Net MVC EnableClientValidation doesnt work.

    - by Farrell
    I want as well as Client Side Validation as Server Side Validation. I realized this as the following: Model: ( The model has a DataModel(dbml) which contains the Test class ) namespace MyProject.TestProject { [MetadataType(typeof(TestMetaData))] public partial class Test { } public class TestMetaData { [Required(ErrorMessage="Please enter a name.")] [StringLength(50)] public string Name { get; set; } } } Controller is nothing special. The View: <% Html.EnableClientValidation(); %> <% using (Ajax.BeginForm("Index", "Test", FormMethod.Post, new AjaxOptions {}, new { enctype = "multipart/form-data" })) {%> <%= Html.AntiForgeryToken()%> <fieldset> <legend>Widget Omschrijving</legend> <div> <%= Html.LabelFor(Model => Model.Name) %> <%= Html.TextBoxFor(Model => Model.Name) %> <%= Html.ValidationMessageFor(Model => Model.Name) %> </div> </fieldset> <div> <input type="submit" value="Save" /> </div> <% } %> To make this all work I added also references to js files: <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script> <script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> Eventually it has to work, but it doesnt work 100%: It does validates with no page refresh after pressing the button. It also does "half" Client Side Validation. Only when you type some text into the textbox and then backspace the typed text. The Client Side Validation appears. But when I try this by tapping between controls there's no Client Side Validation. Do I miss some reference or something? (I use Asp.Net MVC 2 RTM)

    Read the article

  • Apache Commons FileUpload Does not behave like expected

    - by Harry Pham
    I just want to assure you guys that before I post this, I have read couple of similar post but none solved my problem. So here it is. I use Ajax taglib for my form since it wont refresh my screen <%@ taglib uri="WEB-INF/taglib.tld" prefix="a" %> <a:AjaxUpload action="UploadServlet"> <input type="file"> <input type="submit" value="Upload"> </a:AjaxUpload> If this is in any confused you guys, then you can think of the above code will create these form, but send request asynchronously. <form action="UploadServlet" enctype="multipart/form-data" method="post"> <input type="file"> <input type="submit"> </form> My first question is, if I add name="file" inside the <input> to make it become like this, <input type="file" name="file">, my servlet will throw an exception. It wont if I take it out. Here is the exception: SEVERE: Servlet.service() for servlet UploadServlet threw exception javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:637) My second question is: On the server side, I check the request to see if it is isMultipartContent, and it is. But then when I parseRequest() and store into List<FileItem> items, the items.size() is 0. Here is my Servlet code FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List<FileItem> items = null; if(request.getContentType() != null && request.getContentType().toLowerCase().indexOf("multipart/form-data") > -1){ if(upload.isMultipartContent(request)){ items = upload.parseRequest(request); //It got to here, but items.size is 0. why????????????? } }

    Read the article

  • Zend Framework + Uplodify Flash Uploader Troubles

    - by Richard Knop
    I've been trying to get the Uploadify flash uploader (www.uploadify.com) to work with Zend Framework, with no success so far. I have placed all Uploadify files under /public/flash-uploader directory. In the controller I include all required files and libraries like this: $this->view->headScript()->appendFile('/js/jquery-1.3.2.min.js'); $this->view->headLink()->appendStylesheet('/flash-uploader/css/default.css'); $this->view->headLink()->appendStylesheet('/flash-uploader/css/uploadify.css'); $this->view->headScript()->appendFile('/flash-uploader/scripts/swfobject.js'); $this->view->headScript()->appendFile('/flash-uploader/scripts/jquery.uploadify.v2.1.0.min.js'); And then I activate the plugin like this (#photo is id of the input file field): $(document).ready(function() { $("#photo").uploadify({ 'uploader' : '/flash-uploader/scripts/uploadify.swf', 'script' : 'my-account/flash-upload', 'cancelImg' : '/flash-uploader/cancel.png', 'folder' : 'uploads/tmp', 'queueID' : 'fileQueue', 'auto' : true, 'multi' : true, 'sizeLimit' : 2097152 }); }); As you can see I am targeting the my-account/flash-upload script as a backend processing (my-account is a controller, flash-upload is an action). My form markup looks like this: <form enctype="multipart/form-data" method="post" action="/my-account/upload-public-photo"><ol> <li><label for="photo" class="optional">File Queue<div id="fileQueue"></div></label> <input type="hidden" name="MAX_FILE_SIZE" value="31457280" id="MAX_FILE_SIZE" /> <input type="file" name="photo" id="photo" class="input-file" /></li> <li><div class="button"> <input type="submit" name="upload_public_photo" id="upload_public_photo" value="Save" class="input-submit" /></div></li></ol></form> And yet it's not working. The browse button doesn't even show up as in the demo page, I get only a regular input file field. Any ideas where could the problem be? I've already been staring into the code for hours and I cannot see any mistake anywhere and I'm starting to be exhausted after going through the same 30 lines of code 30 times in a row.

    Read the article

  • django image upload forms

    - by gramware
    I am having problems with django forms and image uploads. I have googled, read the documentations and even questions ere, but cant figure out the issue. Here are my files my models class UserProfile(User): """user with app settings. """ DESIGNATION_CHOICES=( ('ADM', 'Administrator'), ('OFF', 'Club Official'), ('MEM', 'Ordinary Member'), ) onames = models.CharField(max_length=30, blank=True) phoneNumber = models.CharField(max_length=15) regNo = models.CharField(max_length=15) designation = models.CharField(max_length=3,choices=DESIGNATION_CHOICES) image = models.ImageField(max_length=100,upload_to='photos/%Y/%m/%d', blank=True, null=True) course = models.CharField(max_length=30, blank=True, null=True) timezone = models.CharField(max_length=50, default='Africa/Nairobi') smsCom = models.BooleanField() mailCom = models.BooleanField() fbCom = models.BooleanField() objects = UserManager() #def __unicode__(self): # return '%s %s ' % (User.Username, User.is_staff) def get_absolute_url(self): return u'%s%s/%s' % (settings.MEDIA_URL, settings.ATTACHMENT_FOLDER, self.id) def get_download_url(self): return u'%s%s/%s' % (settings.MEDIA_URL, settings.ATTACHMENT_FOLDER, self.name) ... class reports(models.Model): repID = models.AutoField(primary_key=True) repSubject = models.CharField(max_length=100) repRecepients = models.ManyToManyField(UserProfile) repPoster = models.ForeignKey(UserProfile,related_name='repposter') repDescription = models.TextField() repPubAccess = models.BooleanField() repDate = models.DateField() report = models.FileField(max_length=200,upload_to='files/%Y/%m/%d' ) deleted = models.BooleanField() def __unicode__(self): return u'%s ' % (self.repSubject) my forms from django import forms from django.http import HttpResponse from cms.models import * from django.contrib.sessions.models import Session from django.forms.extras.widgets import SelectDateWidget class UserProfileForm(forms.ModelForm): class Meta: model= UserProfile exclude = ('designation','password','is_staff', 'is_active','is_superuser','last_login','date_joined','user_permissions','groups') ... class reportsForm(forms.ModelForm): repPoster = forms.ModelChoiceField(queryset=UserProfile.objects.all(), widget=forms.HiddenInput()) repDescription = forms.CharField(widget=forms.Textarea(attrs={'cols':'50', 'rows':'5'}),label='Enter Report Description here') repDate = forms.DateField(widget=SelectDateWidget()) class Meta: model = reports exclude = ('deleted') my views @login_required def reports_media(request): user = UserProfile.objects.get(pk=request.session['_auth_user_id']) if request.user.is_staff== True: repmedform = reportsForm(request.POST, request.FILES) if repmedform.is_valid(): repmedform.save() repmedform = reportsForm(initial = {'repPoster':user.id,}) else: repmedform = reportsForm(initial = {'repPoster':user.id,}) return render_to_response('staffrepmedia.html', {'repfrm':repmedform, 'rep_media': reports.objects.all()}) else: return render_to_response('reports_&_media.html', {'rep_media': reports.objects.all()}) ... @login_required def settingchng(request): user = UserProfile.objects.get(pk=request.session['_auth_user_id']) form = UserProfileForm(instance = user) if request.method == 'POST': form = UserProfileForm(request.POST, request.FILES, instance = user) if form.is_valid(): form.save() return HttpResponseRedirect('/settings/') else: form = UserProfileForm(instance = user) if request.user.is_staff== True: return render_to_response('staffsettingschange.html', {'form': form}) else: return render_to_response('settingschange.html', {'form': form}) ... @login_required def useradd(request): if request.method == 'POST': form = UserAddForm(request.POST,request.FILES ) if form.is_valid(): password = request.POST['password'] request.POST['password'] = set_password(password) form.save() else: form = UserAddForm() return render_to_response('staffadduser.html', {'form':form}) Example of my templates {% if form.errors %} <ol> {% for field in form %} <H3 class="title"> <p class="error"> {% if field.errors %}<li>{{ field.errors|striptags }}</li>{% endif %}</p> </H3> {% endfor %} </ol> {% endif %} <form method="post" id="form" action="" enctype="multipart/form-data" class="infotabs accfrm"> {{ repfrm.as_p }} <input type="submit" value="Submit" /> </form>

    Read the article

  • Servlet, JSP, JavaBeans and HTML form

    - by dedalo
    Hi, I'm working on a servlet that makes a connection to a database gets the information of one of the tables ans sends this information to a jsp file. This file will print on the brower the information table, adding radio buttons that allows us to choose one of the rows. The servlet looks like this: List<InfoBean> items = new ArrayList<InfoBean>(); if (!conexion.isClosed()){ Statement st = (Statement) conexion.createStatement(); ResultSet rs = st.executeQuery("select * from lista_audio" ); while (rs.next()) {items.add(getRow(rs));} conexion.close();} req.getSession().setAttribute("items", items); In the JSP file I can print a table with the information, adding radio buttons that the user will use to choose 1 row and send the selected info to a servlet using a form I can add: < form action="administ" method=get enctype=multipart/form-data> < table> < table border=\"1\">< tr>< th>Title< /th>< th>Author< /th>< th>Album< /th>< /tr> < c:forEach items="${items}" var="item"> < tr>< td><input type="radio" name="SongInfo" value=${item.title}> < td>${item.title}< /td> < td>${item.author}< /td> < td>${item.album}< /td>< /tr> < /c:forEach> < /table> In the field 'value' I should be able to send to the servlet the information stored in ${item.title}. When I set value = ${item.title} and title is, for example "The bodyguard", in the servlet the information I can retrieve is just "The". It looks like it sends the characters located before the first white space of the string. How could I get the whole string? Thanks

    Read the article

  • Uploading on Youtube via HTTP Post

    - by sajid.nizami
    I am following the steps provided on this link [http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html#Browser_based_Upload][1] Whenever I try to upload anything using this method, I get a HTTP 400 error saying that the next_url is not provided. Code is pretty simple and is a copy of Google's own code. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="BrowserUpload.aspx.cs" Inherits="BrowserUpload" %> <%@ Import Namespace="Google.YouTube" %> <%@ Import Namespace="Google.GData.Extensions.MediaRss" %> <%@ Import Namespace="Google.GData" %> <%@ Import Namespace="Google.GData.YouTube" %> <%@ Import Namespace="Google.GData.Client" %> <!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"> <head runat="server"> <title></title> <script type="text/javascript"> function checkForFile() { if (document.getElementById('file').value) { return true; } document.getElementById('errMsg').style.display = ''; return false; } </script> </head> <body> <% YouTubeRequestSettings settings = new YouTubeRequestSettings("Danat", "API-KEY", "loginid", "password" ); YouTubeRequest request = new YouTubeRequest(settings); Video newVideo = new Video(); newVideo.Title = "My Test Movie"; newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema)); newVideo.Keywords = "cars, funny"; newVideo.Description = "My description"; newVideo.YouTubeEntry.Private = false; newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema)); FormUploadToken token = request.CreateFormUploadToken(newVideo); %> <form action="<%= token.Url %>?next_url=<%= Server.UrlEncode("http://www.danatev.com") %>" name="PostToYoutube" method="post" enctype="multipart/form-data" onsubmit="return checkForFile();" > <input id="file" type="file" name="file" /> <div id="errMsg" style="display: none; color: red"> You need to specify a file. </div> <input type="hidden" name="token" value="<%= token.Token %>" /> <input type="submit" value="go" /> </form>

    Read the article

  • Static Javascript files not loaded in Express app

    - by Dave Long
    I have an express app that has a bunch of static javascript files that aren't being loaded even though they are registered in my app.js file. Even public scripts (like jQuery: http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js) aren't processing. I can see the script tags in the generated html, but none of the functionality runs and I can't see the files loading in the web inspector. Here is the code that I have: app.js var express = require('express') var app = module.exports = express.createServer(); // Configuration var port = process.env.PORT || 3000; app.configure(function(){ app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(__dirname + '/public')); }); app.configure('development', function(){ app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); }); app.configure('production', function(){ app.use(express.errorHandler()); }); // Routes app.get('/manage/new', function(req, res){ res.render('manage/new', { title: 'Create a new widget' }); }) app.listen(port); console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env); /views/manage/layout.jade !!! 5 html(lang="en") head title= title link(rel="stylesheet", href="/stylesheets/demo.css") link(rel="stylesheet", href="/stylesheets/jquery.qtip.css") script(type="text/javascript", href="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js") body!= body script(type="text/javascript", href="/javascripts/jquery.formalize.js") script(type="text/javascript", href="/javascripts/jquery.form.js") script(type="text/javascript", href="/javascripts/jquery.qtip.js") script(type="text/javascript", href="/javascripts/formToWizard.js") script(type="text/javascript", href="/javascripts/widget.js") /views/manage/new.jade h1= title div(style="float:left;") form(action="/manage/generate", method="post", enctype="multipart/form-data", name="create-widget") .errors fieldset legend Band / Album Information fieldset legend Social Networks fieldset legend Download All of my javascript files are stored in /public/javascripts and all of my static CSS files are being served up just fine. I'm not sure what I've done wrong.

    Read the article

  • Form data sent to Node via Post is undefined

    - by user185812
    I know this has been asked countless times on here, however I tried all the solutions and am still having the issue. Most people say to set the content-type (which I did) and to name the inputs that I wish to Post to node. I have done both of these things, yet still get "undefined" when trying to send data from an HTML form to node. JADE Templating HTML Code (Sorry I can't seem to get the indenting to show up here, however I think I should leave the code intact when posting here instead of converting it to normal HTML so that if the error is in here, you are still able to help) Form(action="/registration", method="post", enctype="application/x-www-form-urlencoded") div(class="control-group-Username") label(class="control-group", for="username") Username: div.controls input#Username(id="Username", type="text", placeholder="Username Here", maxlength="23", name="username") //Other divs and stuff here button.btn#submit_button(type="submit") Submit app.js code /** * Module dependencies. */ express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path'); app = express(); // all environments app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine','jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(express.cookieParser('your secret here')); app.use(express.session()); app.use(app.router); app.use(require('less-middleware')({ src: __dirname + '/public' })); app.use(express.static(path.join(__dirname, 'public'))); // development only if ('development' == app.get('env')) { app.use(express.errorHandler()); } app.use(express.static(__dirname + '/public')); app.get('/', routes.index); app.get('/users', user.list); app.get('/register', routes.register); http.createServer(app).listen(app.get('port'), function(){ console.log('Express server listening on port ' + app.get('port')); }); require('./Register.js'); register.js code app.post('/registration', function(req, res) { var Email=req.body.username console.log(username); });

    Read the article

  • Using Jquery.Form Plugin + MultiFile to automatically upload a single file

    - by Alan Neal
    I wanted to find a way to upload a single file*, in the background, have it start automatically after file selection, and not require a flash uploader, so I am trying to use two great mechanisms (jQuery.Form and JQuery MultiFile) together. I haven't succeeded, but I'm pretty sure it's because I'm missing something fundamental. Just using MultiFile, I define the form as follows... <form id="photoForm" action="image.php" method="post" enctype="multipart/form-data"> The file input button is defined as... <input id="photoButton" "name="sourceFile" class="photoButton max-1 accept-jpg" type="file"> And the Javascript is... $('#photoButton').MultiFile({ afterFileSelect: function(){ document.getElementById("photoForm").submit(); } }); This works perfectly. As soon as the user selects a single file, MultiFile submits the form to the server. If instead of using MultiFile, as shown above, let's say I include a Submit button along with the JQuery Form plugin defined as follows... var options = { success: respondToUpload }; $('#photoForm').ajaxForm(options); ... this also works perfectly. When the Submit button is clicked, the form is uploaded in the background. What I don't know how to do is get these two to work together. If I use Javascript to submit the form (as shown in the MultiFile example above), the form is submitted but the JQuery.Form function is not called, so the form does not get submitted in the background. I thought that maybe I needed to change the form registration as follows... $('#photoForm').submit(function() { $('#photoForm').ajaxForm(options); }); ...but that didn't solve the problem. The same is true when I tried .ajaxSubmit instead of .ajaxForm. What am I missing? BTW: I know it might sound strange to use MultiFile for single-file uploads, but the idea is that the number of files will be dynamic based on the user's account. So, I'm starting with one but the number changes depending on conditions.

    Read the article

  • php upload file function

    - by Jacksta
    I am trying to write a script which uploads a file via a html form. When I click submit nothing happens. file: upload_form.html <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="do_upload.php" method="post" enctype="multipart/form-data"></form> <p><strong>File to upload</strong></p> <p><input name="img1" type="file" size="30" /></p> <p><input name="submit" type="submit" value="Upolad File" /></p> </body> </html> file: do_upload.php <?php if ($_FILES[img1] != "" { @copy($_FILES[img1] [tm_name], "/tmp" .$_FILES[img1][name]) or die("couldnt copy the file"); } else { die("no file specified"); } ?> <HTML> <head> <title>Successfull File Upload</title> </head> <body> <h1>Success</h1> <p>You sent: <? echo $_FILES[img1][name]; ?>, a <? echo $_FILES[img1][size]; ?>byte filw with a mime type of <? echo $_FILES[img1][type]; ?></p> </body> </HTML>

    Read the article

  • iPhone Development: Use POST to submit a form

    - by Mario
    I've got the following html form: <form method="post" action="http://shk.ecomd.de/up.php" enctype="multipart/form-data"> <input type="hidden" name="id" value="12345" /> <input type="file" name="pic" /> <input type="submit" /> </form> And the following iPhone SDK Submit method: - (void)sendfile { UIImage *tempImage = [UIImage imageNamed:@"image.jpg"]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setHTTPMethod:@"POST"]; [request setURL:[NSURL URLWithString:@"http://url..../form.php"]]; NSString *boundary = @"------------0xKhTmLbOuNdArY"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body appendData:[[NSString stringWithFormat:@"\r\n%@\r\n",boundary] dataUsingEncoding:NSASCIIStringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"id\"\r\n\r\n" dataUsingEncoding:NSASCIIStringEncoding]]; [body appendData:[@"12345" dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[[NSString stringWithFormat:@"\r\n%@\r\n",boundary] dataUsingEncoding:NSASCIIStringEncoding]]; [body appendData:[@"Content-Disposition: form-data; name=\"pic\"; filename=\"photo.png\"\r\n" dataUsingEncoding:NSASCIIStringEncoding]]; [body appendData:[@"Content-Type: application/octet-stream\r\n\r\n" dataUsingEncoding:NSASCIIStringEncoding]]; [body appendData:[NSData dataWithData:UIImageJPEGRepresentation(tempImage, 90)]]; [body appendData:[[NSString stringWithFormat:@"\r\n%@",boundary] dataUsingEncoding:NSASCIIStringEncoding]]; // setting the body of the post to the reqeust [request setHTTPBody:body]; NSError *error; NSURLResponse *response; NSData* result = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString* aStr = [[[NSString alloc] initWithData:result encoding:NSASCIIStringEncoding] autorelease]; NSLog(@"Result: %@", aStr); [request release]; } This does not work, but I have no clue why. Can you please help me?!! What am I doing wrong?

    Read the article

  • MVC Rendered Partial, how to get partial/view model in main model post to controller

    - by user1475788
    I have a text file and when users upload the file, the controller action method parses that file using state machine and uses a generic list to store some values. I pass this back to the view in the form of an IEnumerable. Within my main view, based on this ienumerable list I render a partail view to iterate items and display labels and a textarea. Users could add their input in the text area. When the users hit the save button this ienumrable list from the partial view rendered is null. so please advice any solutions. here is my main view @model RunLog.Domain.Entities.RunLogEntry @{ ViewBag.Title = "Create"; Layout = "~/Views/Shared/_Layout.cshtml"; } @using (Html.BeginForm("Create", "RunLogEntry", FormMethod.Post, new { enctype = "multipart/form-data" })) { <div id="inputTestExceptions" style="display: none;"> <table class="grid" style="width: 450px; margin: 3px 3px 3px 3px;"> <thead> <tr> <th> Exception String </th> <th> Comment </th> </tr> </thead> <tbody> @if (Model.TestExceptions != null) { foreach (var p in Model.TestExceptions) { Html.RenderPartial("RunLogTestExceptionSummary", p); } } </tbody> </table> </div> } partial view as follows: @model RunLog.Domain.Entities.RunLogEntryTestExceptionDisplay <tr> <td> @Model.TestException@ </td> <td>@Html.TextAreaFor(Model.Comment, new { style = "width: 200px; height: 80px;" }) </td> </tr> Controller action [HttpPost] public ActionResult Create(RunLogEntry runLogEntry, String ServiceRequest, string Hour, string Minute, string AMPM, string submit, IEnumerable<HttpPostedFileBase> file, String AssayPerformanceIssues1, IEnumerable<RunLogEntryTestExceptionDisplay> models) { } The problem is test exceptions which contains exception string and comment is comming back null.

    Read the article

  • mvc4 receive form in a controller

    - by Marco Dinatsoli
    i have a form in html and i want to submit it to a controler what i have tried @using (Html.BeginForm("RegisterApartmentOwner", "Home", FormMethod.Post, new { enctype = "multipart/form-data" })) { <p> <label>First Name</label> <input type="text" placeholder="Enter your first Name" name="firstName" /> <span class="errorMessage"></span> </p> <p> <label>Last Name</label> <input type="text" placeholder="Enter your last Name" /> <span class="errorMessage"></span> </p> <p> <label>Password</label> <input type="text" placeholder="Enter your password" name="Password"/> <span class="errorMessage"></span> </p> <p> <label>Password Again</label> <input type="text" placeholder="Enter your password again" name="Password2"/> <span class="errorMessage"></span> </p> <p> <label>Mobile Number</label> <input type="text" placeholder="Enter your mobile number" /> <span class="errorMessage"></span> </p> <p> <input type="submit" value="Register" class="submit"/> </p> } </div> and in the controller i receive the submit in this function public String RegisterTenant() { return "done"; } i can see the done message, however, i want to receive the values of the input that i used in the form, how please? i just to know what to receive the form in the controller

    Read the article

  • Why is this simple file upload not working? JSF

    - by Nitesh Panchal
    Hello, Why is this code not working? I always get size() = 0, whenever i upload file. xhtml file :- <?xml version='1.0' encoding='UTF-8' ?> <!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" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>Abc</title> </h:head> <h:body> <center> <form method="post" enctype="multipart/form-data" id="form" action="/upload/uploadFile"> <input type="file"/> <br/> <input type="Submit" value="upload"/> </form> </center> </h:body> </html> This is my servlet :- package servlets; import java.io.IOException; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; @WebServlet(name="uploadFile", urlPatterns={"/uploadFile"}) public class uploadFile extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, FileUploadException { System.out.println("executed!"); List<FileItem> items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); System.out.println(items.size()); for (FileItem item : items) { if (!item.isFormField()) { System.out.println("Name: " + item.getName()); System.out.println("Size: " + item.getSize()); System.out.println("Type: " + item.getContentType()); } } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (FileUploadException ex) { ex.printStackTrace(); } } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (FileUploadException ex) { ex.printStackTrace(); } } @Override public String getServletInfo() { return "Short description"; } }

    Read the article

  • Floated DIVs not flowing properly

    - by NightMICU
    Hi everyone, I am working on a photo gallery, each thumbnail is in its own DIV and floated to the left in a containing DIV. It has been displaying properly up until vertical thumbnails entered the equation. Now, when the next row should start, the first item of the following row is to the left of the last vertical DIV (thumbnail), rather than flush to the left of the containing DIV. Here is the CSS: #galleryBox { width: 650px; background: #fff; margin: auto; padding: 10px; text-align: center; overflow: auto; } .item { display: block; margin: 10px; padding: 20px 5px 5px 5px; float: left; background: url('/images/content_bottom.png') repeat-x scroll bottom #828282; } and the HTML: <div id="galleryBox" class="ui-corner-all"> <div id="file" class="ui-corner-all"> <form name="uploadPhoto" id="uploadPhoto" method="post" action="" enctype="multipart/form-data"> <p><label for="photo">Photo:</label><input type="file" name="photo" id="photo"/></p> <p><label for="caption">Caption: <small>Optional</small></label><input type="text" id="caption" name="caption"/></p> <p align="center"><input type="submit" value="Upload" name="send" id="send" class="addButton ui-state-default ui-corner-all"/></p> </form> <a name="thumbs"></a> </div> <div class="item ui-corner-all"> <a href="http://tapp-essexvfd.org/gallery/photos/201004211802.jpg" class="lightbox" title="test1"> <img src="http://tapp-essexvfd.org/gallery/photos/thumbs/201004211802_thumb.jpg" alt="test1"/></a><br/> <p><span class="label">test1</span></p> </div> <div class="item ui-corner-all"> <a href="http://tapp-essexvfd.org/gallery/photos/201004211803.jpg" class="lightbox" title="test3"> <img src="http://tapp-essexvfd.org/gallery/photos/thumbs/201004211803_thumb.jpg" alt="test3"/></a><br/> <p><span class="label">test3</span></p> </div> </div>

    Read the article

  • php and asp problem in uploading

    - by moustafa
    i have an ASP web services to change byte array that given from the client and change it to a file and save it in the web server the code is like this : [WebMethod] public string UploadFile(byte[] f, string fileName) { try { MemoryStream ms = new MemoryStream(f); String path="/myfile/"; String location=HttpContext.Current.Server.MapPath(path); FileStream fs = new FileStream(HttpContext.Current.Server.MapPath(path)+fileName, FileMode.Create); ms.WriteTo(fs); ms.Close(); fs.Close(); return "OK"; } catch (Exception ex) { return ex.Message.ToString(); } } the web services need byte array and file name.. i build the client in php upload.php the code is <html> <body> <form action="action1.php" method="post" enctype="multipart/form-data"> Pilih File Anda: <input type="file" name="myfile" /> <input type="submit" value="Upload" /> </form> </body> <html> and action1.php the code is: <?php require_once('nusoap.php'); $client = new nusoap_client('http://192.168.254.160/testuploadah/FileUploader.asmx?WSDL', 'wsdl','','', '', ''); $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; } if(is_uploaded_file($_FILES['myfile']['tmp_name'])){ $uploadFile = $_FILES['myfile']; ////how can read byte array of $uploadFile so i can send to web services??? ////are php only can send array or string ? $params[]->f=??????????????? $params[]->fileName=$_FILES['myfile']['name']; $result = $client->call('UploadFile', $params,'', '', false, true); if ($client->fault) { echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>'; } else { //Check for errors $err = $client->getError(); if ($err) { //// Display the error echo '<h2>Error</h2><pre>' . $err . '</pre>'; } else { //// Display the result echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>'; } } } ?> how can i Send the byte array parameter to the web services,so the web services can started???? i still can resolve this problem,the web services always return an error because i can't send byte array

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9  | Next Page >