I want to use Dropzone.js, but all tutorial I've found are exclusive upload forms.
I have found no doc with mixing image upload with user creation for example.
Am I in a wrong use case?
If not, how can I do it, I don't know how to pass uploaded file name?
How should I have a dedicated form to upload pic, and relation with my User creation in other form...
I'm really not sure how to do this!
Any idea would be appreciated!!!
Related
I'm trying to create a front-end AJAX file uploader for a form and everything is working perfect, except for one issue.
I used deferred binding to enable uploading before the record is created in DB.
In a rare scenario, when someone uploads a file and doesn't send the form the record is not created, but the attached file still exists.
I don't know if there is a build-in solution for this problem is October CMS.
A better example is RainLab Blog Plugin. If you try a new post and add a featured image but not save the post and close the tab, the post doesn't create but the file remains in storage/app/uploads/public.
I was thinking of writing an scheduled task to delete unbinded files, but don't know how to detect them.
Does anyone have a solution for this issue?
you can look at the table:
system_files
and the ones without a
attachment_id or/and
attachment_type or/and
field
are unused maybe the media table should be cleaned too.
I have to make an facebook app where I have an upload form with two inputs of type file. First input of type file is for uploading an image through PHP. After this comes my big problem.
I have the second input from where I should be able to choose a photo from facebook to upload.
I googled a lot, and found no answer to my question.
Now, I now that after I get user permissions like this:
$userinfo = $facebook->api('/me?fields=id,name,email,last_name,first_name,albums,picture,photos');
I can have the images URL's of the user that gave permissions to enter the app.
What I don't know and didn't found anywhere is how to choose and upload what photo I want into my database, from my profile, through PHP.
Is this even possible?!
How can I at least simulate the normal upload like when using normal PHP way?!
I don't want anyone to do my job for me, I just need a start point.
I have been trying to upload multiple images in Laravel 4, using jQuery & Ajax without the page refreshing, with the progress bar, remove button and review (display the uploaded thumbnail where remove deletes it from the DB).
I have taken many approaches, (http://packalyst.com/packages/package/sukohi/surpass) (despite following every step, still doesn't work). Another approach I used (https://gist.github.com/filip-adriginal/bd397c5ec22a5916a966#file-gistfile1-txt) and tried the jQuery-File-Upload.
I am able to upload multiple images using (using foreach in the Controller):
{{ Form::file('image[]', array('multiple'=>true)) }}
I have also looked at videos, tutorials and blogs, but they either had partial information or unsolved problems.
If anyone could give me some sample code, or point me in the right direction, that would be great! Thanks everyone for any help, really appreciate it.
try DropzoneJs. I think it is the best upload JS plugin
Howto : AJAX multiple file upload in Laravel is a great tutorial using Dropzone.js, check it. Also take a look at this tutorial Laravel Ajax Multiple Image Upload and Preview which uses Dropzone.js as well.
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
I would like to use the OneUploader bundle in a Symfony2 form that also contains other fields. In other words, the uploaded file is handled as an attachment to the rest of the data in the form. But I can only find instructions on how add the uploader as a separate form with it's own controller to which the files are sent. So how do I handle the use case I just described?
Bundle dev here.
Frontend uploaders like jQuery File Upload or Dropzone always forge a seperate request when uploading a file to the server. This means that the upload process takes place before the form handling in your controller. If you really want to upload file along with the main form request, then you should not use such an uploader. Instead, create an Entity Media (or the like) map it to the base entity with a OneToMany or ManyToMany association and add it to the form with an Entity type.
There are some pretty good answers here on StackOverflow, for example this one.
However, if you choose to not use a frontend uploader all your files will be sent to the server simultaneously. Depending on the file size / server configuration this can result in upload errors. Moreover the upload will not be performed asynchronously anymore, which forces the user to wait for the upload to complete, after he submitted the form.
There is general problem when dealing with asynchronous multiple uploads on creation forms. I tried to answer a similiar question here.
The problem with enabling file uploads on the create mask is that you eventually end up with orphaned files. This is because a user is able to trigger the upload without saving the actual entity.
Your problem seems like a good use case for the Orphanage feature of this bundle. It lets you upload files before an actual entity exists to attach these files to. After the main form has been submitted you can retrieve the files and perform some more logic on top of it.
Note: This is by no means a perfect solution. Take a look at the limitations! Summarized can be said; as this feature is based on the session, a user may end up having uploaded a file twice. Be sure to handle this accordingly.
And then there is the possibility that you just want to add some more data to the file upload request: As this is handled in the frontend uploader, it differs from implementation to implementation. For example the jQuery File Uploader just serializes the whole form and sends along all other values, including hidden fields.
Personal Recommendation: I'd not send the file along with the form submit request. Instead use a frontend uploader and either:
Let users upload files not until the entity exists where it should be attached. This is a quite common strategy and in most cases the desired one. A simple second step when creating an entity should be sufficient.
Take a look at the Orphanage feature if you really want to be able to upload files directly on the creation mask.