Forums

This topic is locked

PureASPUpload 2.09 Upload Not Req'd

Posted 04 Nov 2002 18:51:06
1
has voted
04 Nov 2002 18:51:06 Alan Cates posted:
Hi,
I have site where I want to upload 1 to 4 images. I presently add a record that has 4 default images named noImage.gif.

When I uncheck Upload Required to allow the user to change only one image and enter only one upload, I get a ''MM_fields.length' is null or not an object' error @ line 116 which reads: <pre id=code><font face=courier size=2 id=code> // create the sql update statement
MM_editQuery = "update " + MM_editTable + " set ";
for (var i=0; i+1 &lt; MM_fields.length; i+=2) {
var formVal = MM_fields[i+1];
</font id=code></pre id=code>
I am only updating the images on the upload page.

The image upload will allow the addition of 1 to 4 images. If the user is loading over their images I want the upload to delete them. If they are replacing a default image, I want it to leave the image.

It appears I either have to create considerable page logic or more simply modify the "DeleteFileBeforeUpdate(" in incPIAddOn.asp. I am not sure I understand the code. I think I would need to change this part of the code:
<pre id=code><font face=courier size=2 id=code>Line 44:
for DOF_fi = 0 to UBOUND(DOF_filesArr)
DOF_file = Trim(DOF_files.Fields.Item(Trim(DOF_filesArr(DOF_fi))).Value&""
if UploadRequest.Exists(DOF_formFieldArr(DOF_fi)) then
if UploadRequest.Item(DOF_formFieldArr(DOF_fi)).Exists("FileName" then
if LCase(DOF_file) &lt;&gt; LCase(UploadRequest.Item(DOF_formFieldArr(DOF_fi)).Item("FileName") then
DOF_file = Server.MapPath(DOF_path & DOF_file)
if DOF_fso.FileExists(DOF_file) then
DOF_fso.DeleteFile(DOF_file)
end if
end if
end if
end if
next
</font id=code></pre id=code>

I think I need to change:
<pre id=code><font face=courier size=2 id=code>Line 48
if UploadRequest.Item(DOF_curKey).Item("FileName" &lt;&gt; "" then</font id=code></pre id=code>

This <i>if NOT ""</i> would change to <i>if NOT "" and if NOT (myfile)</i>

Is this reasonable or am I missing something<img src=../images/dmxzone/forum/icon_smile_question.gif border=0 align=middle>

Alan C

Hosting & Design

Edited by - setac on 04 Nov 2002 19:11:49

Reply to this topic