w3villa Official Blog » Archive
Upload image without submitting form, works on all browsers
If you will have a look at my old post on Uploading files/image with Ajax & Jquery, without submitting a form, you will find that this implementation does not works with Internet Explorer (IE). IE does not supports FormData, so either we can flash or the hidden iframe solution. Now flash is not the best solution as it is not installed in many browsers (and many of the mobile devices does not supports flash). So, the hidden iframe solution is best in our case. Here is how we can implement it : [crayon-519dbf6b0c755/] The above HTML code will do the job. I am using Ruby on Rails framewok. I am returning a text response (If I will sent a JSON response IE will ask to save the response). You can code the same in … Read entire article »
Filed under: Programming
Facebook Send Dialog Error Code: 100 API Error Description: Invalid parameter Error Message: ‘link’ is invalid.
I am using Facebook Send Dialog for posting private message with link to my Facebook application. Earlier it was working fine but now it started throwing error as : [crayon-519dbf6b1a04c/] for sending message I am using code : [crayon-519dbf6b1a265/] I Google about this and only relevant information I get is that Facebook is blocking the link to its own domain as to avoid spam. as I change the link to other live site its working. I need to send link to my application as I have to provide such functionality. Problem Cause: Facebook is not allowing to use its own link as to stop spamming. Problem Solution: There is as such no solution as its bared by Facebook API. Other workout: Shorten URL, but its didn’t works as Facebook check the provided URL. Redirect URL, same as above. In my case I have deployed an additional HTML page just use to redirect to … Read entire article »
Filed under: Programming
Multiple file upload using uploadify via Ajax, Spring-framework in java
If there is a need of uploading multiple file simultaneously through AJAX with Spring framework and its compatibility with multiple web browsers, then the answer is to use uploadify plugin. Here I will describe the steps to do so. If you are using maven then we need the following dependency to be updated: [crayon-519dbf6b1d2ae/] And in your application-context file you need to add bean declaration described below to support multipart request and can set other properties such as maximum upload file size as below: [crayon-519dbf6b1d2fa/] For simple or spring free projects you need not to do upper steps. Working with Uploadify : You can download uploadify from the following link http://www.uploadify.com/download/. Download and unzip the folder you will have the following files: paste the uploadify.css file into your css folder. jquery.uploadify.js in your script folder. download jquery.1.7.2.min.js and put it … Read entire article »
Filed under: Java
Spring Security Auto Login
Whenever you need to use auto-login functionality either in the case of new Registration or some kind of pre-authorization while you are using Spring 3.x for security. You can refer the following code snip : [crayon-519dbf6b1e05a/] userDetailsService is implemented by me as I have to use my custom user and role table. You can have a look on the implementation below: [crayon-519dbf6b1e271/] Also you need to look assembler so that you get the full idea: [crayon-519dbf6b1e2c3/] Need more clarification ? Just comment … Read entire article »
Filed under: Java
Setting up Ruby on Rails application on a Cloud Server
First of all get a Cloud server from a trusty hosting company and get the root permission for SSH Open the terminal and first of all lo-gin to your account [crayon-519dbf6b1fdee/] Type yes to continue root@111.111.111.111′s password: ## Type the password here Now add a new user, we will deploy the server with this user. To do so, type the command on the console [crayon-519dbf6b1fe37/] Enter the new password Enter other information Type y to save the newly created user. [crayon-519dbf6b1fe78/] and add a line w3villa ALL=(ALL) ALL to give newly created user all permissions. SSH configuration Now browse to .ssh/id_rsa.pub file on your local machine, and copy the content of that file. Follow these commands in the remote server : [crayon-519dbf6b1feb8/] and paste the rsa key there. (esc > :wq) to save the file. Now when you will login with the user w3villa again it will … Read entire article »
Filed under: Rails
Installing linecache19 in ruby 1.9.x
When I was installing linecache1.9 I came with this error : [crayon-519dbf6b2813b/] This error came because gem was unable to include the ruby head. So we have to give the option for including the ruby. We can do it with the following command. [crayon-519dbf6b28477/] Hope its work for you, if not then let me know.. :) … Read entire article »
Filed under: Rails
Uploading files/image with Ajax & Jquery, without submitting a form
Here is the code for uploading an image or file without submitting a form with Ajax. For this we will create object of FormData class and will append the properties of the file field in a attribute of FormData object, finally we will set the FormData object with the data key of ajax method of JQuery. [crayon-519dbf6b28a88/] [crayon-519dbf6b28acb/] We can get the parameters of file field by accessing the “file” key of the parameters hash. Sorry to say, but the FormData class is not supported in IE. If you are looking for a solution that works on all browsers have a look at Upload image without submitting form, works on all browsers. … Read entire article »
Filed under: Websites