Rank: Member
Groups: Member
Joined: 8/7/2007(UTC) Posts: 7
|
Hi Eugene, I can't figure out what i need to change. So far I have been using the activex version and it has worked fine. I have only just started using the Java version. I would be grateful if you can point out to me what I need to change. Here's my code for the HTML page and ASPX page: HTML: Code:
<script type="text/javascript">
//<![CDATA[
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 620, 380);
// If you do not want to use ActiveX or Java version, set the appropriate
// property to false.
iu.activeXControlEnabled = true;
iu.javaAppletEnabled = true;
//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "/fotoweb/ImageUploader4.cab";
iu.activeXControlVersion = "4,5,4,0";
//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletCodeBase = "/fotoweb/";
iu.javaAppletCached = true;
iu.javaAppletVersion = "2.5.4.0";
iu.addParam("LicenseKey", "xxxx-xxxx-xxxx");
iu.showNonemptyResponse = "off";
iu.addParam("MaxFileCount", "20");
iu.addParam("MaxTotalFileSize", "52428800");
iu.addParam("MessageMaxTotalFileSizeExceededText", "You are not allowed to upload more than 50 MB at a time.");
//Configure appearance.
iu.addParam("PaneLayout", "TwoPanes");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("AllowRotate", "true");
iu.addParam("BackgroundColor", "#ffffff");
iu.addParam("TreePaneWidth", "205");
iu.addParam("Action", "http://www.xxx.co.uk/aurigmauploader/uploadfw.aspx");
//Configure upload settings.
iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("AutoRecoverMaxTriesCount", "0");
iu.addParam("AutoRecoverTimeOut", "10000");
iu.addParam("AllowAutoRotate", "false");
iu.addParam("AllowRotate", "false");
iu.addParam("TimeOut", "3600000"); // This equals 1 hour
iu.addParam("FolderPaneShowDescriptions", "false");
iu.addParam("AdditionalFormName", "Form1");
//Configure file mask to upload JPEG images only.
iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.tif;*.tiff");
//Add event handlers.
iu.addEventListener("UploadFileCountChange", "ImageUploader_UploadFileCountChange");
iu.addEventListener("ViewChange", "ImageUploader_ViewChange");
iu.fullPageLoadListenerName = "fullPageLoad";
//Configure URL where to redirect after upload.
//iu.addParam("RedirectUrl", "/fotoweb/manage.fwx?rows=2&columns=3");
//Tell Image Uploader writer object to generate all necessary HTML code to embed
//Image Uploader to the page.
iu.writeHtml();
//]]>
</script>
<form id="form1" name="form1">
<input type="hidden" name="accesstoken" value="<%$ CreateUploadAccessToken /%>" />
<input type="hidden" name="username" value="" />
<input type="hidden" name="password" value="" />
<input type="hidden" name="uploadsuccess" value="Yes" />
<input type="hidden" name="user" value="<%$=currentUser.userName %>" />
<input type="hidden" name="aurigma" value="Yes" />
<input type="hidden" name="approved" value="approved" />
</form>
ASPX: Code:
<%@ Page Language="vb" AutoEventWireup="false" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="FOTOWEB" %>
<script language="VB" runat="server">
'file upload post
'This variable specifies a relative path to the folder, where temp images is located.
Private strGalleryPath = "filez/"
'This is where CF will pick up files for processing
Private strCFPath = "CF/"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim uniqueDir as String
' uniqueDir = System.Guid.NewGuid().ToString()
Dim filenames As String
Dim y() As String
Dim a As Short
Dim username, approved, aurigma As String
Dim IPTCInfo As New FOTOWEB.IPTCBlock()
Dim imageInfo As New FOTOWEB.ImageInformationCache()
Dim imageIPTC As FOTOWEB.ImageInformation
username = Request.Form("user")
approved = Request.Form("approved")
'response.write(approved)
aurigma = Request.Form("aurigma")
IPTCInfo.SetField(7, approved)
IPTCInfo.SetField(219, username)
'IPTCInfo.SetField(210, System.Guid.NewGuid().ToString())
Dim MyFileInfo As FileInfo
Dim MyDirectory As DirectoryInfo
'MyDirectory = New DirectoryInfo(Server.MapPath(strGalleryPath))
'For Each MyFileInfo In MyDirectory.GetFiles
' MyFileInfo.Delete
' Next
'Create GUID Directory
'Dim ud As DirectoryInfo = Directory.CreateDirectory(Server.MapPath(strGalleryPath) & "/" & uniqueDir)
Dim SourceFile As HttpPostedFile
Dim fileCount As Integer = Int32.Parse(Request.Form("FileCount"))
'iterate through the uploaded files and save them and iptc data
For i As Integer = 1 To fileCount
'Get source image and save it to disk
SourceFile = Request.Files("SourceFile_" & I)
Dim strFileName As String = Path.GetFileName(SourceFile.FileName)
'response.write(SourceFile.FileName)
'Check whether file with such name already exists and if so,
'construct safe filename name (to avoid collision)
Dim strNewFileName As String = strFileName
Dim J As integer = 1
While File.Exists(Server.MapPath(strGalleryPath & "/" & strNewFileName))
strNewFileName = J & "_" & strFileName
J = J + 1
End While
strFileName = strNewFileName
'save the file on server
'CHECK FILE IS THERE
SourceFile.SaveAs (Server.MapPath(strGalleryPath & "/" & strFileName))
'add iptc data to file
imageInfo.SaveImageText(Server.MapPath(strGalleryPath & "/" & strFileName), IPTCInfo)
'move files / directory into CF channel
File.Move(Server.MapPath(strGalleryPath & "/" & strFileName), server.MapPath(strCFPath & strFileName))
'END CHECK FILE IS THERE
Next
SourceFile = Nothing
imageInfo = Nothing
End Sub
</script>
Edited by user Tuesday, February 12, 2008 2:18:35 PM(UTC)
| Reason: Not specified
|