Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Dmitry.Obukhov  
#1 Posted : Monday, November 1, 2010 8:32:23 PM(UTC)
Dmitry.Obukhov

Rank: Advanced Member

Groups: Administration
Joined: 5/29/2010(UTC)
Posts: 1,310

Thanks: 8 times
Was thanked: 111 time(s) in 111 post(s)
Some of our clients ask us about using non-Flash alternative to upload files in the case if Adobe Flash is not installed on user machines. This article shows two ways of implementing this functionality:

  1. how to redirect to another page with form-based file upload if Adobe Flash is not installed:
    Code:
    <script type="text/javascript">
    		// get installed flash player version
    		// returns an array of three numbers: major version, minor version, revision number.
    		var version = $au.flashDetector.detectVersion();
    		// Image Uploader Flash requires Flash Player 10 or higher
    		if (version[0] >= 10) {
    			var uploader = $au.imageUploaderFlash({
    				id: 'Uploader1',
    				width: '600px',
    				height: '500px',
    				flashControl: {
    					codeBase: 'scripts/aurigma.imageuploaderflash.swf'
    				}
    			});
    
    			uploader.writeHtml();
    
    		} else {
    			if (window.location.search != '?noredirect') {
    				window.location = 'simple_upload.htm';
    			}
    		}
    </script>

    Here is sample code of HTML form upload on the simple_upload.htm page:
    Code:
     <form id="form1" action="simple_upload.htm" enctype="multipart/form-data">
    	<input id="File1" type="file" /><input id="Submit1" type="submit" value="Upload" />
    </form>

  2. how to display form with file input on the same page instead of Flash Uploader:
    Code:
     <!-- Use display:none style to hide this form -->
    	<div id="simple_upload" style="display: none">
    		<form id="form1" action="demo2.htm" enctype="multipart/form-data">
    		<input id="File1" type="file" /><input id="Submit1" type="submit" value="Upload" />
                    </form>
    	</div>
    	<script type="text/javascript">
    		// get installed flash player version
    		// returns an array of three numbers: major version, minor version, revision number.
    		var version = $au.flashDetector.detectVersion();
    		// Image Uploader Flash requires Flash Player 10 or higher
    		if (version[0] >= 10) {
    			var uploader = $au.imageUploaderFlash({
    				id: 'Uploader1',
    				width: '600px',
    				height: '500px',
    				flashControl: {
    					codeBase: 'scripts/aurigma.imageuploaderflash.swf'
    				}
    			});
    			uploader.writeHtml();
    		} else {
    			document.getElementById('simple_upload').style.display = '';
    		}
    </script>

Edited by user Monday, February 21, 2011 8:44:46 PM(UTC)  | Reason: Not specified

Best regards,
Dmitry Obukhov
Technical Support. Aurigma, Inc.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.