Removing files from request before passing to controller - laravel

I am doing image upload in my Laravel application where after selecting some images I want to remove some selected images , I have done that but when submitting ,the request still has all the images selected at the beginning.

What are the changes on your code from the first group of selections to the second?

Related

Avoid reload of gravity form using gform_confirmation_loaded

When using gform_confirmation_loaded, is there a way to keep the form showing even after it's been submitted?
So for example, there's an image upload form. In case the user uploads an image smaller in dimensions than the allowed size, an alert box shows telling them about the size restrictions (this can be easily achieved), and the form stays intact to allow the user upload the image again (the form's got the ajax option enabled).
I'm able to achieve something similar to this where the alert box shows and the page reloads showing the form again and enabling the user to reupload the image.

How can I change my URL before loading my view?

I have a CodeIgniter webpage containing (i) a list of items and (ii) a form to add a new item or edit the details of a selected item.
To select an item for editing, I have an "edit" anchor tag with a hyperlink ending with ?id=nnn. This results in a GET request that populates the detail fields of my selected item and redisplays the list. My URL now contains site_address/index.php/country?id=151.
When I submit my changes the list is updated correctly but my URL remains unchanged. What do I need to do in my controller to remove "?id=151 after my update was successful?
Thanks for your help.
I'm not sure of everything you are doing, so I'll just answer directly:
in your controller, after you update, you can:
redirect('site_address/index.php/country');
Does that fit what you mean?
Through php there's no way to change URL after request expect redirecting
redirect('controller/method');
and you can success message using session flash message after redirecting, if that what makes you want to reload the view

Joomla 2.5 How can I abort a save operation if there's an error?

Is it possible to abort a save operation in a Joomla controller? (Admin Side)
For example:
I have a view with a list of items. I hit the New Item button and in the next page I enter all required fields and hit save. My form also has a file upload field for uploading a small image. That image has to be 25 by 25 pixels or else the new item won't be saved.
The only way I found so far to abort the save operation (if an error like the image size is found) is to call the cancel() method parent::cancel(); in the controller. This takes the user back to the list of items. I need to know if there's another method that will reload the new item form view with all the fields filled from the previous post so the user can just select a correct image and re-post the form without the need to fill all the fields from scratch.
Currently I'm fine with the cancel() method and if the user hits the browser's back button he will probably get back to the form with all the fields loaded, but I was just wondering if there is a way to reload the form.
I don't think there is a way to accomplish this without doing a lot of coding and hacking. Have you considered trying to gauge the size of the image using JavaScript before the image is uploaded? Or allowing people to save the normal data first and then ask for the image?

plupload, how to allow descriptions for uploaded images

I am trying to use the plupload flash widget as it works in all browsers for multiple image upload.
For every image I want my users to select a property from a dropdown box. As every image used in my site represents a property image type ex- rear image, side image, front image etc.. these options will be in the dropdown.
I would like to know, if I can dynamically inject a dropdown to pluploader.
Here is an image to see as how exactly I would like to have the drop down box for every image.
http://www.diigo.com/item/image/2ma3g/9wsq
Upon inspection of the jQuery queue element it is easy enough to determing how to inject your dropdown box into the DOM.
Because it is based on jQuery you can simply use something like..
$('#uploader_filelist li').each(function(index,data){
$(this, '#plupload_file_name').append('<html>Your html here</html>');
});
That is a very simple sample but that is how you would inject markup dynamically into the queue.
The problem is when you do it? And how to identify it later. With this you need to go back to the plupload API and attach events (Documentation here) to the following:
public event FilesAdded(uploader:Uploader, files:Array)
public event UploadProgress(uploader:Uploader, file:File)
And you will need to handle chunks in the script as well as the uplaod handler you are using to retrieve the dropdown value using multipart_params that get set on each chunk uploaded.
Adding the drop down is easy, making sure the process is handled all the way around is another problem and can take some time to perfect.

Rendering Image without postback in MVC from cache

I have a dropdown, that contains some list of StudentCode...
when user select any studentcode student data should be displayed in form with student's Image...
for displaying Student Image, Im putting student image in cache memory... and I have one Iframe that gets the byte data from cache memory and render that image on my page... problem is... this thing need at least 1 postback...
can I make some partial postback to render this image?
I see couple problems with the implementation.
1) You should avoid using IFrames in general as there are better ways of handling rendering parts of the webpage.
2) Storing images in cache means that you actually downloaded all of them for each Student in the dropdown list and placed them in the cache. What if there are 100 students? Getting images for all of them and storing them might take a lot of resources.
I suggest you to do the autopostback on dropdown selected value change (via ajax call) which calls a method that will return a partial view with all the information you need for the particular student, including the image.
I found using Ajaxify library (http://max.jsrhost.com/ajaxify/) very easy and convenient for ajax calls.
You can do the same thing without ajax at all in which case the whole page will reload with the same result.

Resources