Advanced Multi Uploader Support Product Page

This topic was archived

Multiple Uploader + Insert Record on ASP

Reported 21 Feb 2009 19:56:18
1
has this problem
21 Feb 2009 19:56:18 Ivan Halen posted:
Hello,
Seems there are some issues on using Multiple Uploader with insertion of file names into database on ASP
I tried uploading only images: no problem
I followed this tutorial and I got stuck on the Insert Record part: seems that there's no "filename" field as in PHP:

www.ivanhalen.com/multiupload/insert/php.jpg
www.ivanhalen.com/multiupload/insert/asp.jpg

I tried to store name in database using "filedata" hidden field, but it uploads and store only the first image, then gets stuck
Any help, please? Can you give a general check on Multiple Uploader working on ASP server model, please, also with SIP?

PS: more, when inserting a Multi Uploader from the DMXzone tab bar, the default form name given in the panel is NOT "UploadQueue" as shown in PHP tutorial, but a generic "upload1": this can be very confusing for a newbie (strangely, the BACKGROUND code shows the right "UploadQueue" name)

www.ivanhalen.com/multiupload/new/asp.jpg

Thanks
Edited by - Ivan Halen on 21 Feb 2009  19:58:05

Replies

Replied 23 Feb 2009 14:25:57
23 Feb 2009 14:25:57 Miroslav Zografski replied:
Hi Ivan,

For adding a file name into the database on ASP page, you need to create a new hidden field and bind to it a value from Bindings - Upload File(Filedata) -> FileName. "Filedata" field collects all information for the file being uploaded.

"upload1" is the name of the embeded flash. Yes, I agree that it is a bit confusing and I already have this added to extension's fix list.

Regards,

Replied 23 Feb 2009 19:10:59
23 Feb 2009 19:10:59 Ivan Halen replied:
Hi Miroslav,

I followed your suggestions, I created this hidden field:
<input name="PHO_PICTURE" type="hidden" id="PHO_PICTURE" value="<%= pau.Fields("Filedata").FileName %>">

That should take the filename (for each uploaded file, of course) and insert it in a field of the database called "PHO_PICTURE" (same name for input field and database field).

What I get, indeed, is very strange:

1. Every file is quadruplicated: I upload "mypicture.jpg" and I get "mypicture.jpg", "mypicture_2.jpg", "mypicture_3.jpg" and "mypicture_4.jpg"

2. Four records are written on the database, but none of them stores the FileName in the "PHO_PICTURE" database field (that field is empty)

These are my "custom" (not coming from AMU) hidden fields in the form, each of them should insert as default in the other database fields:

<input name="PHO_PICTURE" type="hidden" id="PHO_PICTURE" value="<%= pau.Fields("Filedata").FileName %>">
<input name="PHO_CATEGORY" type="hidden" id="PHO_CATEGORY" value="<%= Request.QueryString("iCat") %>">
<input name="PHO_LISTING" type="hidden" id="PHO_LISTING" value="<%= Request.QueryString("lCat") %>">
<input name="PHO_ACTIVE" type="hidden" value="1">


Four custom hidden fields and four database records inserted: is there a linkage?

EDIT: more, I can't understand the exact meanings of all those things in the Bindings panel: i.e. what is "value"? and "blob"? and "uploadfolder" gives me the full path to uploaded file (/myfolder/myfile.jpg) or only the folder (/myfolder/)? is there a tutorial/help about these?

Edited by - Ivan Halen on 24 Feb 2009  12:52:05
Replied 24 Feb 2009 13:49:12
24 Feb 2009 13:49:12 Miroslav Zografski replied:
Hi Ivan,

Try to get image names directly from FileData field then by adding it to insert record.

Regards,
Replied 24 Feb 2009 14:25:13
24 Feb 2009 14:25:13 Ivan Halen replied:
This is the first thing I did, as you can read in my first post:

QuoteI tried to store name in database using "filedata" hidden field, but it uploads and store only the first image, then gets stuck

Replied 24 Feb 2009 15:29:54
24 Feb 2009 15:29:54 Miroslav Zografski replied:
Ok Ivan,

My miss. Please, post the page code.

Regards,
Replied 24 Feb 2009 17:26:39
24 Feb 2009 17:26:39 Ivan Halen replied:
Sure, Miroslav, here's the whole page (as you can see, here I don't use "FileData" field for inserting into database since it gives me the problems I wrote in my first post):

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/connCubanPuglia.asp" -->
<!--#include virtual="/ScriptLibrary/incSIP2Class.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Class.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Utils.asp" -->
<
%'*** Pure ASP File Upload 3.0.12
' Process form upload1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "../../ScriptLibrary"
pau.TimeOut = 5400
pau.ConflictHandling = "uniq"
pau.StoreType = "path"
pau.UploadFolder = """../../public"""
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.ProcessUpload
pau.SaveAll
%>
<
%' Smart Image Processor 2.5.1
Dim sip1
Set sip1 = New ImageProcessor
sip1.ScriptFolder = "../../ScriptLibrary"
sip1.Component = "AspNet"
sip1.Source = "upload"
sip1.AutoOrient = false
sip1.KeepMetaData = false
sip1.Matte = "#FFFFFF"
sip1.UploadFields = ""
sip1.GetFiles
While sip1.HasFiles
sip1.LoadFromSource
sip1.Resize 400, 300, true
sip1.Overwrite = true
sip1.SaveJPEG 80
sip1.MoveNext
Wend
Set sip1 = Nothing
%>
<
%' Smart Image Processor 2.5.1
Dim sip2
Set sip2 = New ImageProcessor
sip2.ScriptFolder = "../../ScriptLibrary"
sip2.Component = "AspNet"
sip2.Source = "upload"
sip2.AutoOrient = false
sip2.KeepMetaData = false
sip2.Matte = "#FFFFFF"
sip2.UploadFields = ""
sip2.GetFiles
While sip2.HasFiles
sip2.LoadFromSource
sip2.Resize 120, 120, true
sip2.Overwrite = false
sip2.Mask = "##path####name##_small.jpg"
sip2.SaveJPEG 80
sip2.MoveNext
Wend
Set sip2 = Nothing
%>
<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (UploadQueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<
%If (CStr(UploadFormRequest("MM_insert")) = "UploadQueue") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_connCubanPuglia_STRING
    MM_editCmd.CommandText = "INSERT INTO PHOTOGALLERY (PHO_TITLE, PHO_CATEGORY, PHO_LISTING, PHO_ACTIVE) VALUES (?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 100, UploadFormRequest("PHO_TITLE")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(UploadFormRequest("PHO_CATEGORY"), UploadFormRequest("PHO_CATEGORY"), null)) ' adDouble
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, UploadFormRequest("PHO_LISTING")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(UploadFormRequest("PHO_ACTIVE"), UploadFormRequest("PHO_ACTIVE"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "multialt.asp"
    If (UploadQueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="/ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="UploadQueue" id="UploadQueue">
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" width="550" height="350" id="upload1" align="middle">
    <param name="FlashVars" value="<%=pau.flashvars()%>&formName=UploadQueue" />
    <param name="movie" value="dmxMultiUploader.swf" />
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="<%=pau.flashvars()%>&formName=UploadQueue" wmode="transparent" type="application/x-shockwave-flash" width="550" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </object>
  <input type="hidden" name="Filedata" />
  <script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
  <input name="PHO_TITLE" type="hidden" id="PHO_TITLE" value="<%= pau.Fields("Filedata").FileName %>">
  <input name="PHO_CATEGORY" type="hidden" id="PHO_CATEGORY" value="<%= Request.QueryString("iCat") %>">
  <input name="PHO_LISTING" type="hidden" id="PHO_LISTING" value="<%= Request.QueryString("lCat") %>">
  <input name="PHO_ACTIVE" type="hidden" value="1">
  <input type="hidden" name="MM_insert" value="UploadQueue">
</form>
</body>
</html>

As I said, with this page I get 4 images uploaded (xxx.jpg, xxx_2.jpg, xxx_3.jpg and xxx_4.jpg) and 4 records inserted for every file I upload... And no way to insert the filename and/or the full path somewhere in some database fields

Edited by - Ivan Halen on 24 Feb 2009  17:31:16
Replied 25 Feb 2009 13:02:57
25 Feb 2009 13:02:57 Miroslav Zografski replied:
Hi Ivan,

In your code is a missing piece. in PAU code part. So just reapply It and a part of code :
if pau.Done then 
  SetUploadFormRequest "PHO_TITLE",pau.Fields("Filedata").FileName
end if

must be added to it. If its not notify me to investigate that and you can place there the one here. Just change the field name if it is different.

Regards,
Replied 26 Feb 2009 04:20:21
26 Feb 2009 04:20:21 Ivan Halen replied:
I started with a brand new page, here's what I've done:

1. I went to the DMXzone toolbar and clicked on "Advanced Multi Uploader" icon

2. Filled in the form as in the screenshot: www.ivanhalen.com/multiupload/test/01.jpg ; didn't touch Progress tab.

3. Went to Server Behaviors panel and tried to add the Insert Record: get stuck on it since there's nothing to bind: www.ivanhalen.com/multiupload/test/02.jpg

4. Anyway, I bound "FileData" to "PHO_TITLE": www.ivanhalen.com/multiupload/test/03.jpg

5. Here'the code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/connCubanPuglia.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Class.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Utils.asp" -->
<
%'*** Pure ASP File Upload 3.0.12
' Process form upload1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "/ScriptLibrary"
pau.TimeOut = 5400
pau.ConflictHandling = "uniq"
pau.StoreType = "path"
pau.UploadFolder = """../../public"""
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.ProcessUpload
pau.SaveAll
%>
<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%If (CStr(Request("MM_insert")) = "UploadQueue") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_connCubanPuglia_STRING
    MM_editCmd.CommandText = "INSERT INTO PHOTOGALLERY (PHO_TITLE) VALUES (?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 100, Request.Form("Filedata")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "multialt.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="/ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
<form ACTION="<%=MM_editAction%>" name="UploadQueue" id="UploadQueue" method="POST">
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" width="550" height="350" id="upload1" align="middle">
    <param name="FlashVars" value="<%=pau.flashvars()%>&formName=UploadQueue" />
    <param name="movie" value="dmxMultiUploader.swf" />
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="<%=pau.flashvars()%>&formName=UploadQueue" wmode="transparent" type="application/x-shockwave-flash" width="550" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </object>
  <input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
<input type="hidden" name="MM_insert" value="UploadQueue">
</form>
</body>
</html>

Sorry, the part you suggested me is nowhere...
Replied 27 Feb 2009 17:08:24
27 Feb 2009 17:08:24 Ivan Halen replied:
Any update, Miroslav?
Replied 27 Feb 2009 17:38:31
27 Feb 2009 17:38:31 Miroslav Zografski replied:
Hi Ivan,

Sorry, that piece of code must be added by the extension when you add a hidden field and bind to it FileName from Binding tab.
Otherwise you must receive only file-name if you assign in insert record behavior the FileData hidden field added by the AMU.

Regards,
Replied 27 Feb 2009 18:24:59
27 Feb 2009 18:24:59 Ivan Halen replied:
Miroslav, I can't understand
I created an hidden field called "PHO_PICTURE", binded it to FileName in the Binding panel and reapplied the Insert Record behavior: EDIT the new part is there, but I get always 4 records inserted for each uploaded file:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/Connections/connCubanPuglia.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Class.asp" -->
<!--#include virtual="/ScriptLibrary/incPU3Utils.asp" -->
<
%'*** Pure ASP File Upload 3.0.12
' Process form upload1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "/ScriptLibrary"
pau.TimeOut = 5400
pau.ConflictHandling = "uniq"
pau.StoreType = "path"
pau.UploadFolder = """../../public"""
pau.AllowedExtensions = "GIF,JPG,JPEG,BMP,PNG" ' "images"
pau.ProcessUpload
pau.SaveAll
if pau.Done then 
  SetUploadFormRequest "PHO_PICTURE",pau.Fields("Filedata").FileName
end if
%>
<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%If (CStr(Request("MM_insert")) = "UploadQueue") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_connCubanPuglia_STRING
    MM_editCmd.CommandText = "INSERT INTO PHOTOGALLERY (PHO_TITLE, PHO_PICTURE) VALUES (?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 100, Request.Form("Filedata")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 250, Request.Form("PHO_PICTURE")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "multialt.asp"
    If (Request.QueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%></script>
<script src="/ScriptLibrary/incPU3.js" type="text/javascript"></script>
</head>
<body>
<form ACTION="<%=MM_editAction%>" name="UploadQueue" id="UploadQueue" method="POST">
  <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" width="550" height="350" id="upload1" align="middle">
    <param name="FlashVars" value="<%=pau.flashvars()%>&formName=UploadQueue" />
    <param name="movie" value="dmxMultiUploader.swf" />
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="<%=pau.flashvars()%>&formName=UploadQueue" wmode="transparent" type="application/x-shockwave-flash" width="550" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </object>
  <input type="hidden" name="Filedata" />
<script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
<input type="hidden" name="MM_insert" value="UploadQueue">
<input name="PHO_PICTURE" type="hidden" id="PHO_PICTURE" value="<%= pau.Fields("Filedata").FileName %>">
</form>
</body>
</html>

Have you tested the extension on Adobe CS4? Am I the only one with this problem? (consider that I'm doing these tests on the working PC, the one that has no problem in uploading/resizing speed... but the same i'ts on the other PC, so I guess it's not a my-PCs-related problem)

Please, I need a more consistent support, I can't wait two days to get an unuseful answer

Edited by - Ivan Halen on 28 Feb 2009  13:39:26
Replied 05 Mar 2009 15:35:28
05 Mar 2009 15:35:28 Ivan Halen replied:
Miroslav, you left me here alone: same old story with DMXzone support
Well, there are no much solutions... or this problem get resolved in a reasonable time (4 records inserted for each file uploaded IS A BIG PROBLEM) or I want my money back: simply and easy
Replied 06 Mar 2009 10:40:57
06 Mar 2009 10:40:57 Miroslav Zografski replied:
Hi Ivan,

I'm sorry for the delay in my answer. I did a lot of testing on that issue, but was unable to recreate it. What I can do is to pass here the code of my testing page. I'm using DW CS4 on WinXP with IIS 5.1 for testing as well as Vista with IIS 7.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/remote.asp" -->
<!--#include file="ScriptLibrary/incPU3Class.asp" -->
<!--#include file="ScriptLibrary/incPU3Utils.asp" -->
<!--#include file="ScriptLibrary/incSIP2Class.asp" -->
<
%'*** Pure ASP File Upload 3.0.12
' Process form upload1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.UploadFolder = """uploads"""
pau.ProcessUpload
pau.SaveAll
if pau.Done then 
  SetUploadFormRequest "PHO_TITLE",pau.Fields("Filedata").FileName
end if
%>
<%' Smart Image Processor 2.5.1
Dim sip1
Set sip1 = New ImageProcessor
sip1.ScriptFolder = "ScriptLibrary"
sip1.Component = "AspNet"
sip1.Source = "upload"
sip1.AutoOrient = false
sip1.KeepMetaData = false
sip1.Matte = "#FFFFFF"
sip1.UploadFields = ""
sip1.GetFiles
While sip1.HasFiles
sip1.LoadFromSource
sip1.Resize 400, 300, true
sip1.Overwrite = true
sip1.SaveJPEG 80
sip1.MoveNext
Wend
Set sip1 = Nothing
%>
<%' Smart Image Processor 2.5.1
Dim sip2
Set sip2 = New ImageProcessor
sip2.ScriptFolder = "ScriptLibrary"
sip2.Component = "AspNet"
sip2.Source = "upload"
sip2.AutoOrient = false
sip2.KeepMetaData = false
sip2.Matte = "#FFFFFF"
sip2.UploadFields = ""
sip2.GetFiles
While sip2.HasFiles
sip2.LoadFromSource
sip2.Resize 120, 120, true
sip2.Overwrite = false
sip2.Mask = "##path####name##_small.jpg"
sip2.SaveJPEG 80
sip2.MoveNext
Wend
Set sip2 = Nothing
%>
<
%Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (UploadQueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<
%' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
  If condition = "" Then
    MM_IIf = ifFalse
  Else
    MM_IIf = ifTrue
  End If
End Function
%>
<
%If (CStr(UploadFormRequest("MM_insert")) = "UploadQueue") Then
  If (Not MM_abortEdit) Then
    ' execute the insert
    Dim MM_editCmd

    Set MM_editCmd = Server.CreateObject ("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_remote_STRING
    MM_editCmd.CommandText = "INSERT INTO dbo.PHO (PHO_TITLE, PHO_CATEGORY, PHO_LISTING, PHO_ACTIVE) VALUES (?, ?, ?, ?)" 
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 100, UploadFormRequest("PHO_TITLE")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 201, 1, 45, UploadFormRequest("PHO_CATEGORY")) ' adLongVarChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 202, 1, 50, UploadFormRequest("PHO_LISTING")) ' adVarWChar
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param4", 5, 1, -1, MM_IIF(UploadFormRequest("PHO_ACTIVE"), UploadFormRequest("PHO_ACTIVE"), null)) ' adDouble
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    ' append the query string to the redirect URL
    Dim MM_editRedirectUrl
    MM_editRedirectUrl = "amuInsertTest.asp"
    If (UploadQueryString <> "") Then
      If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then
        MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
      Else
        MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
      End If
    End If
    Response.Redirect(MM_editRedirectUrl)
  End If
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script type="text/javascript"><%=pau.generateScriptCode()%>

/* BEGIN Advanced HTML Editor */
var BaseURL = "";
/* END Advanced HTML Editor */
</script>
<script src="ScriptLibrary/incPU3.js" type="text/javascript"></script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--

/* BEGIN Advanced HTML Editor */
.dmx_btn     { width: 22px; height: 22px; border: 1px solid #ECE9D8; margin: 0; padding: 0; background-color: #ECE9D8; }
.dmx_btnOver { width: 22px; height: 22px; border: 1px outset; margin: 0; padding: 0; background-color: #FCF9E8; }
.dmx_btnDown { width: 22px; height: 22px; border: 1px inset; margin: 0; padding: 0; background-color: #FCF9E8; }
.dmx_btnNA   { width: 22px; height: 22px; border: 1px solid #ECE9D8; margin: 0; padding: 0; -moz-opacity:0.25; opacity:0.25; filter: alpha(opacity=25);}
.dmx_menuBar { background-color: #ECE9D8; }
/* END Advanced HTML Editor */
-->
</style>
<script language="JavaScript" src="ScriptLibrary/AdvHTMLLang.js"></script>
<script language="JavaScript" src="ScriptLibrary/AdvHTMLEdit.js"></script>
</head>
<body>
<form ACTION="<%=MM_editAction%>" name="UploadQueue" id="UploadQueue" method="POST">
  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0','width','550','height','350','id','upload1','align','middle','src','dmxMultiUploader','name','upload1','quality','best','flashvars','<%=pau.flashvars()%>&formName=UploadQueue','wmode','transparent','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','dmxMultiUploader' ); //end AC code
</script><noscript><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,63,0" width="550" height="350" id="upload1" align="middle">
    <param name="FlashVars" value="<%=pau.flashvars()%>&formName=UploadQueue" />
    <param name="movie" value="dmxMultiUploader.swf" />
    <param name="quality" value="best" />
    <param name="wmode" value="transparent" />
    <embed src="dmxMultiUploader.swf" name="upload1" quality="best" flashvars="<%=pau.flashvars()%>&formName=UploadQueue" wmode="transparent" type="application/x-shockwave-flash" width="550" height="350" pluginspage="http://www.macromedia.com/go/getflashplayer" />  
</object></noscript>
  <input type="hidden" name="Filedata" />
  <script type="text/javascript">window.upload1 = document.forms["UploadQueue"].upload1;</script>
  <input type="hidden" name="PHO_TITLE" id="PHO_TITLE" value="<%= pau.Fields("Filedata").FileName %>" >
  <input name="PHO_CATEGORY" type="hidden" id="PHO_CATEGORY" value="<%= Request.QueryString("iCat") %>">
  <input name="PHO_LISTING" type="hidden" id="PHO_LISTING" value="<%= Request.QueryString("lCat") %>">
  <input name="PHO_ACTIVE" type="hidden" value="1">
  <input type="hidden" name="MM_insert" value="UploadQueue">
</form>
</body>
</html>


Regards,

Replied 06 Mar 2009 13:16:58
06 Mar 2009 13:16:58 Ivan Halen replied:
Are you using Access 2003 as database?
Replied 06 Mar 2009 14:50:05
06 Mar 2009 14:50:05 Miroslav Zografski replied:
Hi,

I'm on MS SQL Server 2005. But even with Access 2002-2003 files I had no problems with upload and add to DB. With that same page I passed a code of.

Regards,



Replied 17 Apr 2009 17:28:04
17 Apr 2009 17:28:04 Ivan Halen replied:
Miroslav, I gave up some weeks ago about this, but now I NEED it to work, or get a refund
The problem is still the same: each file get inserted 4 times
Neither the new PAU 3.0.13 solved the question
Please, help me strongly to fix this or give me a refund

Thanks

For your information: I just tried with ASP + MySQL, images are still inserted 4 times

Edited by - Ivan Halen on 17 Apr 2009  17:36:42
Replied 17 Apr 2009 17:52:31
17 Apr 2009 17:52:31 Miroslav Zografski replied:
Hello Ivan,

I'll do my best.

Regards,

Reply to this topic