Add a progress bar in Laravel form? - php

I am working on a simple profile update form and I need to have a progress bar for the photo upload. I am new to this and have no clue where to begin.
I am trying to upload the file as an input field in the form with the type as file. With larger files, I cannot track if the upload has failed or frozen and would like a progress bar.
I can create a bar which is filling according to percentage but I still need to have the information from the server which I don't understand how.
I read somewhere that PHP 5.4 and above provides this information via the $_SESSION in the form of session.upload_progress.name but I also read somewhere else that Laravel does not use the conventional session and this won't work.
Is there a way to get this to work. I don't have a multiple image upload so I don't wish to install those third party libraries out there. I just want to keep it simple and somehow fetch the upload information from the server.
What is the simplest way to go around this problem?

The simplest way is to do it via jQuery and AJAX - using something like http://www.dropzonejs.com/ - which is awesome and very easy to use

Related

PHP File Upload Without Form

Is there a way that I can allow a user to upload a file by providing the filename/directory for the file in a get variable (or some way other than using a form)?
Essentially, I'd like the user to be able to do something like this:
http://example.com/upload.php?file=C:/files/myFile.txt
and have upload.php handle the upload.
I've been looking at this to try to figure out how to do this, along with a couple of other resources, but they're all focused around using forms.
I need to be able to allow an app to go to my php page and provide a file to be uploaded without a prompt.
It doesn't have to be in a GET, but I CANNOT PROMPT for a file.
Any thoughts?
Sorry, that's not possible. You can upload file using post request. Why are you trying to send data using get request?

Save user generated form content as a PDF on server

I have some report that is generated from a form. I need this form to be saved automatically on the server, on submitting. Is there any way to do it?
I tried researching on the subject, but Google just throws up links where the user gotta input the URL and press submit or such method. As this pdf should be generated and saved automatically after every form submission, I guess the preferable method would be to call a service or such to generate the PDF and then save it on the server. Can you plz give me a walk-through.Thanks in Advance.
I'm working in PHP.
Here is the pdf docs from php.net. It's all there for the taking. Good luck!
PDF - Manual
I am about to embark on the same journey as I need to create a script to turn a document into a .pdf file using PHP. I don't know a lot about it yet, but it does seem possible. Try this link for starters...
http://www.sitepoint.com/generate-pdfs-php/

Uploading a photo with PHP and jquery?

I want to have a single button that when clicked opens a file dialogue, and then after the user selects the photo they want to upload and the dialogue closes. I want the photo to upload. I cant think of a way of doing this because in the form you cant use both the type = file and type = submit together. Would I need to use jquery to achieve this? Thanks.
Yes, the idea is to use jQuery for the inital part of having a user pick a file to upload... and then some sort of other, server-side language (like PHP,) will actually do the heavy lifting (by actually uploading the file.)
Here's a jQuery plugin that helps you do this:
http://blueimp.github.com/jQuery-File-Upload/
EDIT:
Yes, I believe with jQuery (or some other library... or plugin,) it would be possible to have an event listener (or something,) pick up when a user browses for a file to upload... and automatically starts to upload it once the file has been chosen. But, again, as was said earlier, it's probably safer to take a two-step approach to file uploads for now.
try this
One-Click Upload is a jQuery plugin that replaces the standard file
input element, allowing you to use any link, image or element to be
used for the purpose of bringing up the "file browse" dialogue. It
completes the upload behind the scenes without refreshing the page,
making it less obtrusive and easier to style than a standard upload
form.
To get the upload started the way you describe you will need to use JavaScript. jQuery is a very good library to use to make that process easier, but it is not required.

Difference between Ajax upload and Normal upload

i have a doubt with the upload system in PHP.
What is the difference between Normal Upload [ without ajax ] and Ajax Upload ?
By using Javascript i can send values to the server ,is it possible in the case of Files ?
Is there any limitation for this ? and i found that so many uploaders are using FLASH for to upload FILES,
ex:Gmail,uploadify.....
How can i build a basic uploader with JQUERY/javascript ? also i heard that i cant send FILE by a XHR request.
i am using Codeigniter Framework.
Expecting Possible duplicate or other refference
Main Goal Of this Question is to build my own uploader for my current project[neat and clean]
Okay, AJAX upload is basically just that, it's going through Javascript. The difference is that the page does not upload, and you can carry on with other things as it works. It generally makes for a better user experience in my opinion, it feels more seamless
On the other hand, it only works for newer browsers. Firefox, Chrome, Opera have it, but not IE (maybe Safari?). It also works well with drag and drop. I once made an image uploader inside a text editor, where it popped up a table with your currently uploaded images, you clicked one and it added it to the textbox or you dragged a new image into a box and it uploaded and displayed it straight away. It was beautiful.
Here's the plugin I used to help me
http://dropup.net/
Edit: No limitations either, you can even send plain binary data in
well as if you want to upload the file with jquery ajax request then use ajax form plugin as well,
this link Ajax From will help you to understand and implement on your page,
but i don't know about codignighter frame work cause i don't have experience of that. And ajax is the best way to distribute the process into different parts with any extra load on the page i mean ajax request will work on the back end..

Jquery PHP media upload library

Strange trouble
I want to upload image via ajax which many plugin does but none support textarea to write caption. As i want to assign a caption to every image ,how do my new learning task makes it different is i want user to be able to put up caption whilst image is uploading.
Do any one know of such plugin that just donot send ajax request but also have text box requests attached
Well, to answer your question, I don't know of any such plugin.
However, all plugins should support custom parameters to send as GET or POST. Check the documentation.
If it doesn't, then it sucks. You can however mod it yourselt.
If it does, then it is a simple issue of fetching the textarea value and attaching it in one such parameter to be sent.
Hope this helps you.

Categories