3

I think I found a really cool JQuery file upload plugin but it seems they do not have a PHP server side example and I'm a little overwhelmed on how to set it up.

Can you kindly help me out and show me how to use it?

Here's the link to their page:

https://github.com/mihaild/jquery-html5-upload

4
  • Have you contacted the script author? Seems like this is something he should be providing as part of the documentation. (Incidentally, you might also take a look at blueimp.github.com/jQuery-File-Upload which is more complete in that respect.) Commented May 9, 2012 at 18:15
  • No. There's an option for the upload URL. The PHP script is not part of the plugin. Commented May 9, 2012 at 18:16
  • You might also take a look at php.net - example #3 gives an instance of processing multiple files (but with a different approach to the HTML). Commented May 9, 2012 at 18:17
  • A google search for "php HTML5 multiple file upload" returned this question. Commented May 9, 2012 at 18:20

2 Answers 2

1

I don't know the plugin, but basically you need to set an URL where the files should be "sent" to (take a look at the example.html file on github):

$("#upload_field").html5_upload({
    url: /*PATH TO PHP FILE.php*/,
    ...

The PHP file depends on what you want to do: Store the files in a database, store them on the server... However, if you want to store them in a folder, take a look at this code I used in a HTML5 file uploader:

//Count files
$count = count($_FILES['file']['name']);
for($i = 0; $i < $count; $i++){
    //Path
    $filepath = 'upload/'.basename($_FILES['file']['name'][$i]);

    //Save file
    move_uploaded_file($_FILES['file']['tmp_name'][$i], $filepath);
}

It's very basic, it doesn't check for errors, file types and things like that. Remember to adjust the input name: $_FILES['INPUT NAME HERE'][.....

Sign up to request clarification or add additional context in comments.

Comments

0

I was looking at jquery-html5-upload, but it is still very young, low documentation and demos, no server side demo, etc...!

On the other hand, here's a good tutorial to get you on the right track with HTML5 and Jquery for File Uploads:

Tutorial :: html5-file-upload-jquery-php

html5uploader

and my personal favorite: jQuery-File-Upload

Ps:

Place a request on the jquery-html5-upload for the author include a server side example.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.