keep file order using jquery file upload - javascript

I was looking at the upload script here:
http://demo.tutorialzine.com/2013/05/mini-ajax-file-upload-form/
It is using jquery file upload to upload multiple files at once. I would like to know how to pass the order of the files that were selected to the upload.php script. ie. if you have 1.jpg, 2.jpg, 3.jpg, 4.jpg, and 4 finishes uploading first, can upload.php receive a variable that tells it that it is the 4th image that was selected? Does jquery file upload have a way of adding the order to the form action perhaps?
Thanks in advance.

It should automatically upload and read the data in the order it was received once it hits the upload.php layer. So just make sure you upload the files in the order you want them.

Well it was a really easy fix once I found it. There is a variable in the jquery.fileupload.js file called sequentialUploads. Set it to true, and it will force the order of uploads to be the order in which the files are selected.

Related

Avoid file uploading in Dropzone.js - interested in JSON contents in browser

I'm using Dropzone.js to allow a user to upload some .json files to a web app. These json files are then parsed and used on a different page.
I've got this working using the 'addedfile' event and a FileReader() object.
However, I would like to avoid dropzone trying to upload the files and making a failed POST call to '/undefined'.
How could I achieve this?
Thanks!
You need to set autoProcessQueue dropzone option to false. With autoProcessQueue set to false dropzone will not upload files independently. Check Dropzone.js documentation for more details.

ckeditor - file renaming issue

Need your kind assistance in fixing the file rename issue. I am using ckeditor to manage the content. When i upload an image say 'blue-kpi.png' and again if i try to upload the same image it renamed the file to 'blue-kpi(1).png'.
This works fine. I want no alert message should be displayed it directly upload the file without any alerts and file renaming functionalities will work as it is.
In short, user will not see the name of the file.
Go to this address and edit it functions
ckeditor\plugins\filemanager\connectors\php\io.php
// Do a cleanup of the file name to avoid possible problems
function SanitizeFileName($sNewFileName).............

jQuery File Upload - Get Folder Name

I'm using JQuery FileUpload in my web application. Things are working fine. Now i want to extend the behavior and get the folder name from uploaded file. Requirement is to get the folder name when user drop a file on page or select it through the file selection dialog. For this i tried to use callback "fileuploadchange" and "fileuploaddrop". Both worked and i was able to get the selected file collection i.e data.files but data.files[0] didn't contains any information about the source folder. Any idea on how this can be achieved ?
Thanks in advance.
You can only get info on what the user decides to "give" you, for security reasons. You might get that functionality by using some flash plugin, but with html/js you are not allowed into the users pc, not even folder names (thankfully)

Need to do bulk file upload in JavaScript

I have a little bit of an unusual situation I guess. I have a page for placing new orders and part of a new order is a variable (0-n) number of files that are to be uploaded and associated with the order on the back end. The user also needs to specify a description for each file.
I've used a couple jQuery upload plug-ins with great success, but in this case I'm not looking to upload a single file when the user hits "OK." What I really need to do is upload a file by passing a local path to some method that will do the upload.
Does anyone know of any plug-ins that do this?
Thanks!
Ajax Uploader could be helpful? I believe it allows multiple uploads.

Ajax based File Uploads

I'm looking for a javascript/ajax based file upload. The way it would work is this:
1) User clicks browse
2) User selects CTRL and selects the files he wants to upload
3) Via Javascript the user is shown a few loading graphics (1 per each file being uploaded)
4) After each upload finishes, a loading graphic is replaced with a success graphic and the filename of the uploaded file.
So what I'm really asking for is:
1) A way to do javascript/ajax based file uploads.
2) A way to detect when a file starts/finishes uploading, or to call a function when it happens.
Check http://valums.com/ajax-upload/ it's a neat plugin.
I recently faced a similar problem. We had been using Uploadify (http://www.uploadify.com/) to do uploads. I wrote a blog post on how to use Uploadify to perform multiple file uploads:
http://blog.bobcravens.com/2011/03/upload-multiple-files-with-progress-using-uploadify/
There are a couple of supported options:
Use a single 'input' element and select multiple files.
Use multiple 'input' elements to select a single file each.
Hope this helps.
Bob

Categories

Resources