Skip to content

Instantly share code, notes, and snippets.

@gideondsouza
Created May 31, 2016 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gideondsouza/1367104cfc8a83c4b5c924fe467d6032 to your computer and use it in GitHub Desktop.
Save gideondsouza/1367104cfc8a83c4b5c924fe467d6032 to your computer and use it in GitHub Desktop.
Uploading multiple files with ruby, uplodify and sinatra : http://www.gideondsouza.com/blog/uploading-multiple-images-with-ruby-and-sinatra/
<html>
<head>
<title>Image Upload</title>
<link rel="stylesheet" type="text/css" href="uploadify.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.uploadify.min.js"></script>
</head>
<body>
<h1>Upload Images</h1>
<input type="file" name="file_upload" id="file_upload" />
<script>
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : '/upload',
'onUploadSuccess' : function(file, data, response) {
$("#images").append("<img src='/" + data + "' height='100px'/>");
}
});
});
</script>
<div id="images">
<strong>Uploaded images here:</strong><br />
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment