w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Mvc .net: Upload Multiple files in multiple fields via one http post
View: <input type="file" name="Photos"> <input type="file" name="Photos"> <input type="file" name="Logos"> <input type="file" name="Logos"> <input type="file" name="Video"> You can populate uploaders with javascript. Controller: [HttpPost] public ActionResult Create( ViewModel model, IEnumerable<HttpPostedFileBase> Photos, IEnumerable<HttpPostedFileBase> Logos, HttpPostedFileBase Video ) { ... } We can also post uploaded files via a View Model, which is much more cleaner. Check this for details.

Categories : Asp Net Mvc

Django Image file upload default to random images
The idea. import os import os.path from random import choice from shutil import copy_file ... filename_list = os.listdir( ADMIN_DIR ) filename_to_copy = choice( filename_list ) file_to_copy = os.path.join( ADMIN_DIR, filename_to_copy ) # it contains a file to copy # 'change_filename' is a function that changes a file name for a result file. You should implement it. new_file = os.path.join( DEST_DIR, change_filename( filename_to_copy ) ) # then copy this file to a destination dir. copyfile( file_to_copy, new_file )

Categories : Python

dropzone.js image upload acceptedMimeTypes
You could add more extensions to your if, like so: if (file.type != "image/jpeg" && file.type != "image/png") { This will check if the file type is different from ALL of the types you specify. For a file to pass the check, it has to be different from image/jpeg AND image/png Update I would advise to look at enyo's answer since he is the author of Dropzone.

Categories : PHP

Select One Active Image from multiple Multiple Images
what about this <input type="file" name="images[]" /> <input type="hidden" name="active[]" value="0" class="active" /> <input type="radio" name="activeImage[]" onclick="$('.active').val(0);$(this).prev().val(1)" value="1" /> Now when you dump the data in php you have to active the image based on the index in post array like [active] => Array ( [0] => 0 [1] => 1 [2] => 0 ) So you know that active[1] contains value 1 so second image is selected by user , so make active second image in the $_FILES array Hope you got my idea

Categories : PHP

Dropzone image upload options not working :(
Just add before Jquery call Dropzone.autoDiscover = false; and remove the action from the <form>. That will disable the auto discover function so you can specify all the options for your form. This is what your code should look like: <html> <head> <title></title> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="dropzone.js" type="text/javascript"></script> <link href="css/basic.css" rel="stylesheet" type="text/css" /> <link href="css/dropzone.css" rel="stylesheet" type="text/css" /> </head> <body> <script type="text/javascript"> $(document).ready(function(){ Dropzone.autoDiscover = false; $("#uploadme

Categories : PHP

How to upload multiple images in php
check this one https://github.com/blueimp/jQuery-File-Upload/wiki/jQuery-File-Upload,---Multi-file-upload-with-CodeIgniter Struggling To Use PyroCMS Files Library To Upload Multiple Files

Categories : Codeigniter

Facebook Multiple Images upload
I'm doing some modification in code please try this, and let me know HUD = [[MBProgressHUD alloc] initWithView:self.view]; HUD.labelText = @"Uploading Images"; [self.view addSubview:HUD]; [HUD show:YES]; NSMutableArray *aryFetchedImages = [self fetchPhotosForAlbum]; for (int i = 0; i < aryFetchedImages.count ; i++) { [self postImgWithMessage:[aryFetchedImages objectAtIndex:i]; } [HUD show:NO]; [HUD removeFromSuperview]; //my code to be added -(void)postImgWithMessage:(UIImage *)image { NSArray *paths1 = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *filePath =[[paths1 objectAtIndex:0] stringByAppendingPathComponent:@"image.png"]; NSData *imageData = [NSData d

Categories : IOS

Upload multiple images with preview
You can use some plugins for file upload, that supports such functions. I've used this one: http://blueimp.github.io/jQuery-File-Upload/ However, this feature is no supported by IE9 and lower.

Categories : Jquery

How to Upload Multiple Images from HTML from to FIles?
For uploading multiple files its better to use input field names as array, so the uploaded files will be well organized as an array that can be easily handled. So your upload form should look something like this <form action="upload.php" method="post" enctype="multipart/form-data"> Image1: <input name="image[]" type="file" /><br /> Image2: <input name="image[]" type="file" /><br /> Image3: <input name="image[]" type="file" /><br /> Image4: <input name="image[]" type="file" /><br /> Image5: <input name="image[]" type="file" /><br /> <input type="submit" value="Upload" /> </form> And in the upload.php if($_FILES['image']) { //organise the array :: refer http://php.net/manual/en/features.file-upload.multip

Categories : PHP

Upload multiple images in mysql database by php
you need to build an array to insert the data to the table, i have assumed you have two field called name and data. Please correct it as needed. for($i=0; $i<count($_FILES['name']['name']); $i++){ if ($_FILES['name']['error'][$i] == 0) { $dataf = file_get_contents($_FILES['name']['tmp_name'][$i]); $data = array('file_name' => $_FILES['name']['name'][$i], 'data' => $dataf); $this->db->insert('table', $data); } }

Categories : PHP

How to upload multiple images to server in html
With [] into the name field it create an array where you can see all files to upload Try this code: <form id="styleImageForm1" method= "post" action="../imageUpload/productStyle.json" enctype="multipart/form-data"> <input type="file" id="my-element1" name="commonsMultipartFile[]" value="" multiple /> </form>

Categories : HTML

multiple Image upload fails to upload only the first image
"upload" here $_FILES['upload'] refers to the name of the file field in the form. you are only ckecking if a file from the file field named upload has been uploaded did you maybe name the first upload field in the form differently?

Categories : PHP

django form multiple fields dynamically
i did this without using django forms .. just using html forms to upload multiple as many as user wishes.. this is my template.html file which has normal form without any input file field initially the js method adds a new input file field to the form when clicked on "add new item" href <form action="{{request.path}}" method="post" enctype="multipart/form-data" id="upload_form"> {%csrf_token%} <input type="text" name="name" id="name" value="{{request.POST.name}}" placeholder="Person Name"/> <input type="text" name="categorie" id="categorie" value="{{request.POST.categorie}}" placeholder="Categorie"/> <div class="file_inputs" id="file_inputs"> <!-- <-- field where im adding multiple files initially empty --> </div>

Categories : Python

Using Python-django or html how to upload multiple files without using any packages?
From sources, in HTML5 you can do like, <input type="file" name="multiple_file_field" multiple>

Categories : Python

Select multiple fields with single group by in django
I don't think this is possible without either: raw sql additional query to retrieve objects filtered by aggregation result (which is possible with little help from Q objects) Edit 1: Regarding solution no 2. This still may be not the best idea, but it's the quickest I could come up with: from django.db.models import Max, Q from operator import __or__ as OR result_dict = Score.objects.values('season').annotate(Max('punt')) q = [Q(season=row['season']) & Q(punt=row['punt__max']) for row in result_dict] qs = Score.objects.filter(reduce(OR, q)) Check out this link for more details: http://css.dzone.com/articles/best-way-or-list-django-orm-q

Categories : Python

Django bulk create for models with multiple required fields
You can do it like this: demographic = Demographic.objects.get(id=7) PersonDemographic.objects.bulk_create( [PersonDemographic(person=person, demographic=demographic) for person in Person.objects.some_query_set()] )

Categories : Django

Paperclip multiple image upload
Considering you are saving the records into the same database as your form, it seems that you need to discount using accepts_nested_attributes_for, which is what I'd normally use with Paperclip Saving Multiple Records At Once It seems your main problem is saving multiple records at once: No handler found for {"0"=> This shows that Rails is not able to compute the save function, as it's only designed for single params. You'll actually have to save the records with a manual SQL query, like these resources: INSERT multiple records using ruby on rails active record How to implement bulk insert in Rails 3 Essentially, you somehow have to loop through your params array, and save the data in one bulk way. Here is one way you could do it: As per one of those links, you could use the a

Categories : Ruby

how to show multiple images in Django admin panel
Can't you loop over the path first? def product_Image(self): """Method to return store image for admin panel""" images = '' for image_path in self.image_paths: images += '<img src="/images/%s" height="150" width="150"/>' % image_path return images

Categories : Python

When loading multiple images from network requests, should I return the image data or a link to the image?
I think the difference is as following: 1- the user will download : (link+image > image) more data stream. 2- if the image is on another server -> might be slower than your server or faster -> affect the image loading speed provided for the user and minimize transmitted data size between your server and the client. 3- if the image is on another server -> do you guarantee that it will be there when your website is up ? 4- loading data using ajax is already an asynchronous method and you don't have to worry about another server if you use it. well, unless your server is as slow as hell then you should consider using another server for the big images as the synchronization won't be your major concern as it is the load you are applying to your server. if other points come to my mind, I'll

Categories : PHP

multiple image upload validation javascript
You could swap if(isset()) with if(!empty()) in the first line to check whether any file has been uploaded. On client side you could add parameter "required" to <input type=file> That's my first thought Id suggest re-writing the script to use Exceptions: <?php if(!empty($_FILES['files'])) { try { foreach($_FILES['files']['tmp_name'] as $key => $tmp_name ) { $file_name = $key.$_FILES['files']['name'][$key]; $file_size =$_FILES['files']['size'][$key]; $file_tmp =$_FILES['files']['tmp_name'][$key]; $file_type=$_FILES['files']['type'][$key]; if($file_size > 2097152) throw new Exception('File size must be less than 2 MB'); $query="INSERT into upload_data (`USE

Categories : PHP

how to upload multiple image in node.js using formidable with express
You don't need to work directly with formidable to do that. The BodyParser() from express does what you want (it uses formidable). Just refere to the doc: req.files

Categories : Node Js

Change one image into the multiple images.
<form action="" method="GET"> <input type="url" name="image1"/> <input type="url" name="image2"/> <input type="url" name="image3" /> <input type="submit"/> </form> <?php echo '<img src="'.$_GET['image1'].'"/>'; echo '<img src="'.$_GET['image2'].'"/>'; echo '<img src="'.$_GET['image3'].'"/>'; ?>

Categories : PHP

how to upload multiple image in my backend component joomla form
In your XML you have to define new element <field name="image" type="myelement" label="" description="" class="inputbox" /> Now create file models/fields/myelement.php If you use XML file to load form from models/forms/myform.xml it will be found automatically. If not add attridute to <fieldset> parent element addfieldpath="/components/com_custom/models/fields/" Now in that file create class. <?php defined('_JEXEC') or die(); jimport('joomla.html.html'); jimport('joomla.form.formfield'); class JFormFieldMyelement extends JFormField { public $type = 'Myelement'; public function getInput() { } } Now return whatever you want. You can incorporate any 3d party uploader. For examples what to return in getInput() start typing JFormField and you will s

Categories : Joomla

Extjs / Javascript: How to put images vertically - aligned with other fields (textboxes,combos) in a multiple line panel with hbox layout?
You could use the Ext.isIE property to set the dimensions based on the browser, for example: margin: Ext.isIE ? '0 5 6 5' : '0 5 5 5' //or whatever the appropriate values are You'll still have to worry about counting pixels, but at least it will look the same in both browsers.

Categories : Javascript

How make a image using multiple images using Carrierwave and MiniMagick
Assuming the real question here is about compositing images with minimagick, here's some code. Note that I've added a field to Movie called "composite_image", and I've decided that the uploader attached to Image is named "file". def render_composite_image(source_images, coordinates) temp_file = TempFile.new(['render_composite_image', '.jpg']) img = MiniMagick::Image.new(temp_file.path) img.run_command(:convert, "-size", "#{ COMPOSITE_WIDTH }x#{ COMPOSITE_HEIGHT }", "xc:white", img.path) source_images.each_with_index do |source_image, i| resource = MiniMagick::Image.open(source_image.file.path) img = img.composite(resource) do |composite| composite.geometry "#{ coordinates[i].x }x#{ coordinates[i].y }" end end img.write(temp_file.path) self.update_attribut

Categories : Ruby On Rails

jQuery autocomplete ON multiple fields as well as TO multiple fields
Supply a callback function to handle the select event as an init option or bind to the select event. See api documentation on the select event. The select event will pass an event object. The event object has the property named target. You can use this property to determine the which DOM element initiated the event. Something LIKE this will work. $( "input" ).autocomplete({ source: "search.php", select: function(event,ui){ var targetFieldId = event.target.id; //get id of DOM element ie bar2 var relatedField = document.getElementById(targetFieldId+'email'); //get related field relatedField.val(ui.item.value); // assuming second varible is value } });

Categories : Jquery

Truble to delete an uploaded image using Jquery Multiple file upload plugins
you have to use call back function to make it work. The callback function is the function that will handle the data received from the server via the event fileuploaddone. Thus, you will have such code : $('#fileupload').bind('fileuploaddone', callbackfunc); // Your callback function function callbackfunc(e, data) { /* your code, like : if (data.kind === "error") alert(data.message); */ } But you can shorten it via an anonymous function : $('#fileupload').bind('fileuploaddone', function (e, data) { /* your code, like : if (data.kind === "error") alert(data.message); */ }) For deletion, the callback can be bound with event fileuploaddestroy (see this page : BlueImp options). let me know if i can help you further.

Categories : PHP

Best way to upload multiple files as part of a REST API? Single or multiple POST requests?
To do this, you'd need your client to upload in mime/multipart format. I don't know PHP, but I'm sure there's a library out there that will support receiving/parsing the multipart messages you get. As for whether it's a good idea .. If initiating the request is the creation of a single resource, it's not unreasonable to accept mime/multipart. If the parts being sent are themselves full-fledged resources, it would probably be better to make the client send them up separately, and reference them in the initiation request. Also note that mime/multipart is going to be a bit harder for your clients to deal with than simple requests. This post seems to be related to what you're trying to accomplish.

Categories : Api

Uploading multiple files with dropzone js plugin and session security: no parallel uploads?
Answering my own question after only 2 days! The sec_session_start function contains session_regenerate_id(true);. In order to prevent unauthorized uploads, the upload page has session authentication. So when multiple files were being uploaded simultaneously, the session info was being regenerated but it wasn't being propagated in time, so only one or maybe two files would get in. I realized the issue while debugging multiple parallel ajax requests. (The ajax page uses the same authorization checks.) Not wanting to completely get rid of the regeneration, I added a parameter $ajax=0 to the sec_session_start. This way I could leave untouched all the other (non-parallel activity) pages. I changed the line to if (!$ajax) session_regenerate_id(true);. Now on the parallel activity pages

Categories : PHP

find multiple records on basis of multiple fields in mysql table
If I understood you correctly, this query would work for you: SELECT p1.id, p1.name, p1.sku, p1.programme FROM product p1 JOIN product p2 ON p1.sku = p2.sku AND p1. programme <> p2.programme If not then please add some sample data and expected result. Based on sample data, try this query: SELECT * FROM product WHERE id IN( SELECT p1.id FROM (SELECT MIN(id) as id, sku, programme FROM product GROUP BY sku, programme) p1 JOIN (SELECT MIN(id) as id, sku, programme FROM product GROUP BY sku, programme) p2 ON p1.sku = p2.sku AND p1.programme <> p2.programme )

Categories : Mysql

Count multiple occurrence of multiple fields in a column corresponding to another attribute
You do not need to use UNION for that. You can do this using SUM() function and CASE statement like this: SELECT Name ,SUM(CASE WHEN Fruit = 'Mango' THEN 1 ELSE 0 END) AS MangoCount ,SUM(CASE WHEN Fruit = 'Apple' THEN 1 ELSE 0 END) AS AppleCount ,SUM(CASE WHEN Fruit = 'Banana' THEN 1 ELSE 0 END) AS BananaCount FROM MyTable GROUP BY Name; You can also use this dynamic query: SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'SUM(CASE WHEN `Fruit` = ''', `Fruit`, ''' THEN 1 ELSE 0 END) AS `', `Fruit`, '`' ) ) INTO @sql FROM MyTable; SET @sql = CONCAT('SELECT Name, ', @sql,' FROM MyTable GROUP BY Name '); PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;

Categories : Mysql

Can't insert multiple data against an id into multiple fields in a table in mySQL?
It would be really helpful, if you could post your MySQL statement used for inserting the data. The canonical way would be: INSERT INTO `shirts`(`p_id`, `colors`, `random`) VALUES (1, 'red', 400), (1, 'green', 400), (1, 'orange', 400);

Categories : PHP

What would be the best way to go about writing this in JS/jQuery? (Multiple individual objects with multiple fields)
Honestly, with the amount of data you are talking about and the number of ways it could be modified, you should look into a framework that is more robust and was designed to make data binding much easier. There are many out there, but my personal favorite is AngularJS. http://angularjs.org/ Start looking into this as it may save you a lot of time in developing the app and then of course maintaining it down the road.

Categories : PHP

Android: How to make merge multiple bitmap images to a large jpeg image
The problem with image manipulation is if you don't do it correctly you end up copying the entire image several times. The challenge is to try to keep only one buffer for the image. Something like the following will be pretty efficient. // create one big bitmap Bitmap finalBitmap = Bitmap.create(finalWidht, finalHeight, Bitmap.Config.ARGB_8888); for(int i=0;i<numTilesWide;i++) { for(int j=0;j<numTilesHigh;j++) { int[] tilePixels = // load tile bitmap into this int array // copy tile onto final bitmap finalBitmap.setPixels(tilePixels, 0, tileWidth, i*tileWidth, j*tileHeight); } } // write the image as a jpeg to the file finalBitmap.compress(Bitmap.CompressFormat.JPEG, 50, /* file stream */);

Categories : Android

java GUI trying to get multiple inputs from multiple text fields
Only call addActionListener(this); for your button, don't listen to actions on your textFields, because your actionPerformed method is being called when actions occur on your textfield (user hits enter). I'm guessing your doing this after the first field and that your action method is getting called by this and then waiting for the socket connection, as that is a blocking call, this would make your GUI unresponsive.

Categories : Java

Concatenate multiple fields on multiple rows with commas
I think this will work for you SELECT s.ip, GROUP_CONCAT(i.name) FROM servers AS s JOIN serverInstances AS si ON s.ID = si.sID JOIN Instances AS i ON si.iID = i.ID GROUP BY s.ip

Categories : PHP

Upload Images to Amazon S3 using Django
boto is the best way to do this. You can get an existing bucket using: get_bucket(bucket_name, validate=True, headers=None) After installing boto, this code should do what you need to do from boto.s3.connection import S3Connection from boto.s3.key import Key conn = S3Connection('<aws access key>', '<aws secret key>') bucket = conn.get_bucket('<bucket name>') k = Key(bucket) k.key = 'file_path_on_s3' # for example, 'images/bob/resized_image1.png' k.set_contents_from_file(resized_photo) Here are some links to the Boto API and Boto S3 Doc

Categories : Python

How to upload images to Django media without subdirectory
Turns out there was a pretty big clue in the error from my earlier attempt (the one generating _1, _2 etc) If I specify an upload_to callable that simply returns the filename argument, then the image will be saved directly in the MEDIA_ROOT, with the correct filename saved in the database (without the directory prefix). I had been under the impression that upload_to will just provide a path to append to MEDIA_ROOT, which will then have the image filename appended to that. Turns out this is incorrect, there's a little bit more magic going on there than that. (Still need to dig into the Django code to understand exactly what)

Categories : Django

django images upload dir and template handling
The upload_to argument should be a path relative to your MEDIA_ROOT setting. The url that you'll use to access the file is the same relative path appended to your MEDIA_URL setting. Also check out the documentation on FileFields and ImageFields and on the MEDIA_ROOT and MEDIA_URL settings

Categories : Django

How can I use imshow to display multiple images in multiple windows?
Yes, it is possible. The function void imshow(const string& winname, InputArray mat) displays an image in the specified window, where - winname – Name of the window. image – Image to be shown. The window is identified by its name. So to display two images(img1, img2), in two different window; use imshow with different name like :- imshow("1",img1); imshow("2",img2);

Categories : Opencv



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.