This is a noob question, but I can’t get Valum’s Uploader to work no matter what I do. I extracted the files from the zip file and tried the demo.htm page in the client folder, but each time I try to upload something, I get a message saying the upload failed. Can someone tell me how to use this thing? Also, how do I use the action parameter?
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="fileuploader.css" rel="stylesheet" type="text/css">
<style>
body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;}
</style>
</head>
<body>
<p><a href="http://github.com/valums/file-uploader">Back to project page</a></p>
<p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p>
<p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p>
<div id="file-uploader-demo1">
<noscript>
<p>Please enable JavaScript to use file uploader.</p>
<!-- or put a simple form for upload here -->
</noscript>
</div>
<script src="fileuploader.js" type="text/javascript"></script>
<script>
function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader-demo1'),
action: 'fileuploader.js',
debug: true
});
}
// in your app create uploader as soon as the DOM is ready
// don't wait for the window to load
window.onload = createUploader;
</script>
</body>
</html>
You need to point the uploader to a server side script that will handle the upload.
Right now when you are creating a new qq.FileUploader in the javascript on your page you pass the parameter:
action: ‘fileuploader.js’
That is a javascript file that handles the client side uploading. You need to have a different server side file that handles the upload on the server side. There are a few options available in the Github repository https://github.com/valums/file-uploader/tree/master/server depending if you are running PHP or Perl or Coldfusion there are different files to use.
It also sounds like you are ‘running’ the file by opening the demo.htm file in the extracted folder. In order for this to work you need a web-server with php or perl etc. If your running windows and easy one to get started with is Uniserver.